comparison vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.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\ExactVersionConstraint
17 */
18 class ExactVersionConstraintTest extends TestCase {
19 public function compliantVersionProvider() {
20 return [
21 ['1.0.2', new Version('1.0.2')],
22 ['4.8.9', new Version('4.8.9')],
23 ['4.8', new Version('4.8')],
24 ];
25 }
26
27 public function nonCompliantVersionProvider() {
28 return [
29 ['1.0.2', new Version('1.0.3')],
30 ['4.8.9', new Version('4.7.9')],
31 ['4.8', new Version('4.8.5')],
32 ];
33 }
34
35 /**
36 * @dataProvider compliantVersionProvider
37 *
38 * @param string $constraintValue
39 * @param Version $version
40 */
41 public function testReturnsTrueForCompliantVersion($constraintValue, Version $version) {
42 $constraint = new ExactVersionConstraint($constraintValue);
43
44 $this->assertTrue($constraint->complies($version));
45 }
46
47 /**
48 * @dataProvider nonCompliantVersionProvider
49 *
50 * @param string $constraintValue
51 * @param Version $version
52 */
53 public function testReturnsFalseForNonCompliantVersion($constraintValue, Version $version) {
54 $constraint = new ExactVersionConstraint($constraintValue);
55
56 $this->assertFalse($constraint->complies($version));
57 }
58 }