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

Commit 7319b2f

Browse files
author
Lars Vierbergen
committed
Add negative satisfaction test
1 parent fb5821f commit 7319b2f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,28 @@ function testSatisfiedBy() {
167167
}
168168
}
169169
}
170+
function testNotSatisfiedBy() {
171+
$t=array(
172+
'1.0.0'=>'1.0.1',
173+
'1.2.3'=>'2.0.0',
174+
'<1.0.1'=>array('1.0.1','1.0.2','1.2.0','2.0.0'),
175+
'<=2'=>array('2.0.1','2.1.5','3.0.0'),
176+
'>=2.4'=>array('1.2.0','2.0.0'),
177+
'3.x'=>array('1.0.0','1.9.9','2.999.9999','4.0.0'),
178+
'<1.5.6 || >=2.3.4 <3.0.0'=>array('1.5.6','1.5.7','1.6.0','2.1.0','2.3.0','2.3.3','3.0.0','3.2.1'),
179+
'1.2.0 - 2.1.2'=>array('1.1.2','2.1.2','2.2.0'),
180+
'>4.0.0 <=4.2.3'=>array('4.0.0','4.2.4','4.5.0','3.2.2')
181+
);
182+
foreach($t as $range=>$satisfies) {
183+
$e=new versionExpression($range);
184+
if(!is_array($satisfies)) {
185+
$satisfies=array($satisfies);
186+
}
187+
foreach($satisfies as $version) {
188+
$v=new version($version);
189+
$this->assertFalse($e->satisfiedBy($v), '['.$range.' :: '.$version.'] %s');
190+
$this->assertFalse($v->satisfies($e), '['.$range.' :: '.$version.'] %s');
191+
}
192+
}
193+
}
170194
}

0 commit comments

Comments
 (0)