Skip to content

Commit 4cf7bde

Browse files
committed
Updated tests.
1 parent 0bec6ec commit 4cf7bde

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

tests/testsuites/ParseTest.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,21 @@ public function test_getTag(): void
201201
array(
202202
'label' => 'Custom tag name, without number (beta tag number)',
203203
'version' => '1.0-custom-beta5',
204-
'expected' => 'custom-beta5',
204+
'expected' => 'Custom-beta5',
205205
'type' => VersionParser::TAG_TYPE_BETA,
206206
'tagNumber' => 5
207207
),
208208
array(
209209
'label' => 'Custom tag name, with number (beta tag number)',
210210
'version' => '1.0-custom3-beta5',
211-
'expected' => 'custom3-beta5',
211+
'expected' => 'Custom3-beta5',
212212
'type' => VersionParser::TAG_TYPE_BETA,
213213
'tagNumber' => 5
214214
),
215215
array(
216216
'label' => 'Custom tag name, without known tag (no tag number)',
217217
'version' => '1.0-custom3',
218-
'expected' => 'custom3',
218+
'expected' => 'Custom3',
219219
'type' => VersionParser::TAG_TYPE_NONE,
220220
'tagNumber' => 0
221221
)
@@ -381,6 +381,18 @@ public function test_preserveOriginalCharsInBranch() : void
381381
$this->assertEquals('Super:branch', $version->getBranchName(), $testLabel);
382382
}
383383

384+
public function test_normalizeBranchName() : void
385+
{
386+
$version = VersionParser::create('1.2 "Super branch/epic*new"');
387+
388+
$testLabel = print_r($version->toArray(), true);
389+
390+
$tag = $version->getTagInfo();
391+
$this->assertNotNull($tag);
392+
$this->assertEquals('Super branch/epic*new', $tag->getBranchName(), $testLabel);
393+
$this->assertEquals('SuperBranch/Epic*New', $tag->getBranchNameNormalized(), $testLabel);
394+
}
395+
384396
public function test_branchNameAfterTag() : void
385397
{
386398
$version = VersionParser::create('1.2-beta2 "Super branch"');
@@ -390,6 +402,7 @@ public function test_branchNameAfterTag() : void
390402
$this->assertEquals('1.2.0', $version->getVersion(), $testLabel);
391403
$this->assertEquals('beta', $version->getTagType(), $testLabel);
392404
$this->assertEquals('Super branch', $version->getBranchName(), $testLabel);
405+
$this->assertEquals('1.2.0-SuperBranch-beta2', $version->getTagVersion(), $testLabel);
393406
}
394407

395408
public function test_branchNameBeforeAndAfterTag() : void

0 commit comments

Comments
 (0)