@@ -29,6 +29,13 @@ public function test_parse()
2929 'int ' => 1001001000000 ,
3030 'normalized ' => '1.1.1 '
3131 ),
32+ array (
33+ 'label ' => 'Triple digit version ' ,
34+ 'version ' => '1.12.348 ' ,
35+ 'expected ' => 1012348 ,
36+ 'int ' => 1012348000000 ,
37+ 'normalized ' => '1.12.348 '
38+ ),
3239 array (
3340 'label ' => 'Triple digit version, higher numbers ' ,
3441 'version ' => '5.12.134 ' ,
@@ -39,30 +46,58 @@ public function test_parse()
3946 array (
4047 'label ' => 'With beta tag ' ,
4148 'version ' => '1.0.0-beta ' ,
42- 'expected ' => 1000000.0001 ,
43- 'int ' => 1000000000100 ,
49+ 'expected ' => 999999.000101 ,
50+ 'int ' => 999999000101 ,
51+ 'normalized ' => '1.0.0 '
52+ ),
53+ array (
54+ 'label ' => 'With beta tag, numbered 2 ' ,
55+ 'version ' => '1.0.0-beta2 ' ,
56+ 'expected ' => 999999.000201 ,
57+ 'int ' => 999999000201 ,
4458 'normalized ' => '1.0.0 '
4559 ),
4660 array (
4761 'label ' => 'With alpha tag ' ,
4862 'version ' => '1.0.0-alpha ' ,
49- 'expected ' => 1000000.000001 ,
50- 'int ' => 1000000000001 ,
63+ 'expected ' => 999999.000002 ,
64+ 'int ' => 999999000002 ,
5165 'normalized ' => '1.0.0 '
5266 ),
5367 array (
5468 'label ' => 'With release candidate tag ' ,
5569 'version ' => '1.0.0-rc ' ,
56- 'expected ' => 1000000.01 ,
57- 'int ' => 1000000010000 ,
70+ 'expected ' => 999999.010001 ,
71+ 'int ' => 999999010001 ,
72+ 'normalized ' => '1.0.0 '
73+ ),
74+ array (
75+ 'label ' => 'With branch name ' ,
76+ 'version ' => '1.0.0-BranchName ' ,
77+ 'expected ' => 1000000 ,
78+ 'int ' => 1000000000000 ,
79+ 'normalized ' => '1.0.0 '
80+ ),
81+ array (
82+ 'label ' => 'With branch name and release candidate tag ' ,
83+ 'version ' => '1.0.0-BranchName-rc ' ,
84+ 'expected ' => 999999.010001 ,
85+ 'int ' => 999999010001 ,
86+ 'normalized ' => '1.0.0 '
87+ ),
88+ array (
89+ 'label ' => 'With underscores as separators ' ,
90+ 'version ' => '1.0.0_BranchName_rc ' ,
91+ 'expected ' => 999999.010001 ,
92+ 'int ' => 999999010001 ,
5893 'normalized ' => '1.0.0 '
5994 )
6095 );
6196
6297 foreach ($ tests as $ test )
6398 {
6499 $ version = VersionParser::create ($ test ['version ' ]);
65-
100+
66101 $ this ->assertEquals ($ test ['expected ' ], $ version ->getBuildNumber (), $ test ['label ' ]);
67102 $ this ->assertEquals ($ test ['int ' ], $ version ->getBuildNumberInt (), $ test ['label ' ]);
68103 $ this ->assertEquals ($ test ['normalized ' ], $ version ->getVersion (), $ test ['label ' ]);
0 commit comments