Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Commit 98b6faf

Browse files
Add tests for invalid versions
1 parent 7319b2f commit 98b6faf

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function testSimpleversionWildcard() {
7878
'1.x.x'=>'>=1.0.0 <2.0.0',
7979
'1.x'=>'>=1.0.0 <2.0.0',
8080
'1.x.5'=>'>=1.0.0 <2.0.0',
81-
'3.x2'=>'>=3.0.0 <4.0.0',
81+
'3.x'=>'>=3.0.0 <4.0.0',
8282
'1.X.X'=>'>=1.0.0 <2.0.0',
8383
'1.*.*'=>'>=1.0.0 <2.0.0',
8484
'2.X.x'=>'>=2.0.0 <3.0.0',
@@ -111,6 +111,24 @@ function testShortversionRange() {
111111
$this->assertEqual($v->getString(),$result,'['.$original.'] %s');
112112
}
113113
}
114+
function testInvalidVersion() {
115+
$t=array(
116+
'3.x2',
117+
'',
118+
'xx',
119+
'2.xx',
120+
'**.2',
121+
'Xx*',
122+
'.2.2',
123+
'1..2',
124+
'1.5.6.x',
125+
'1.5.6.7'
126+
);
127+
foreach($t as $original) {
128+
$this->expectException(new versionException('Invalid version string given'));
129+
$v=new versionExpression($original);
130+
}
131+
}
114132
function testAndOperator() {
115133
$t=array(
116134
'<1.2.0 >=1.3.2'=>array(array('<1.2.0','>=1.3.2')),

0 commit comments

Comments
 (0)