Mercurial > hg > isophonics-drupal-site
comparison vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 /* | |
3 * This file is part of PharIo\Version. | |
4 * | |
5 * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> | |
6 * | |
7 * For the full copyright and license information, please view the LICENSE | |
8 * file that was distributed with this source code. | |
9 */ | |
10 | |
11 namespace PharIo\Version; | |
12 | |
13 use PHPUnit\Framework\TestCase; | |
14 | |
15 /** | |
16 * @covers PharIo\Version\OrVersionConstraintGroup | |
17 */ | |
18 class OrVersionConstraintGroupTest extends TestCase { | |
19 public function testReturnsTrueIfOneConstraintReturnsFalse() { | |
20 $firstConstraint = $this->createMock(VersionConstraint::class); | |
21 $secondConstraint = $this->createMock(VersionConstraint::class); | |
22 | |
23 $firstConstraint->expects($this->once()) | |
24 ->method('complies') | |
25 ->will($this->returnValue(false)); | |
26 | |
27 $secondConstraint->expects($this->once()) | |
28 ->method('complies') | |
29 ->will($this->returnValue(true)); | |
30 | |
31 $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); | |
32 | |
33 $this->assertTrue($group->complies(new Version('1.0.0'))); | |
34 } | |
35 | |
36 public function testReturnsTrueIfAllConstraintsReturnsTrue() { | |
37 $firstConstraint = $this->createMock(VersionConstraint::class); | |
38 $secondConstraint = $this->createMock(VersionConstraint::class); | |
39 | |
40 $firstConstraint->expects($this->once()) | |
41 ->method('complies') | |
42 ->will($this->returnValue(true)); | |
43 | |
44 $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); | |
45 | |
46 $this->assertTrue($group->complies(new Version('1.0.0'))); | |
47 } | |
48 | |
49 public function testReturnsFalseIfAllConstraintsReturnsFalse() { | |
50 $firstConstraint = $this->createMock(VersionConstraint::class); | |
51 $secondConstraint = $this->createMock(VersionConstraint::class); | |
52 | |
53 $firstConstraint->expects($this->once()) | |
54 ->method('complies') | |
55 ->will($this->returnValue(false)); | |
56 | |
57 $secondConstraint->expects($this->once()) | |
58 ->method('complies') | |
59 ->will($this->returnValue(false)); | |
60 | |
61 $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); | |
62 | |
63 $this->assertFalse($group->complies(new Version('1.0.0'))); | |
64 } | |
65 } |