Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 863e308

Browse files
committed
updated phpunit 5.7 fallback
Alias Assert is redundant update travis configuration swap order of phpunit version
1 parent 0f138e8 commit 863e308

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ cache:
1515

1616
env:
1717
global:
18+
- COMPOSER_ARGS="--no-interaction --prefer-source"
19+
- LEGACY_DEPS="phpunit/phpunit"
1820
- SITE_URL: https://zendframework.github.io/zend-eventmanager
1921
- GH_USER_NAME: "Matthew Weier O'Phinney"
2022
- GH_USER_EMAIL: [email protected]
@@ -46,7 +48,8 @@ before_install:
4648
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi
4749

4850
install:
49-
- travis_retry composer install --no-interaction --prefer-source
51+
- travis_retry composer install $COMPOSER_ARGS
52+
- if [[ $TRAVIS_PHP_VERSION =~ ^5.6 ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi
5053
- composer info -i
5154

5255
script:

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626
"psr-4": {
2727
"ZendTest\\EventManager\\": "test/",
2828
"ZendBench\\EventManager\\": "benchmarks/"
29-
}
29+
},
30+
"files": [
31+
"test/_autoload.php"
32+
]
3033
},
3134
"require": {
3235
"php": "^5.6 || ^7.0"
3336
},
3437
"require-dev": {
35-
"phpunit/PHPUnit": "^5.7.14 || ^6.0.7",
38+
"phpunit/PHPUnit": "^6.0.7 || ^5.7.14",
3639
"athletic/athletic": "^0.1",
3740
"zendframework/zend-stdlib": "^2.7.3 || ^3.0",
3841
"container-interop/container-interop": "^1.1.0",

src/Test/EventListenerIntrospectionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Zend\EventManager\Test;
1111

12-
use PHPUnit\Framework\Assert as Assert;
12+
use PHPUnit\Framework\Assert;
1313
use ReflectionProperty;
1414
use Zend\EventManager\EventManager;
1515

test/Test/EventListenerIntrospectionTraitTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace ZendTest\EventManager\Test;
1111

1212
use PHPUnit\Framework\ExpectationFailedException;
13-
use PHPUnit_Framework_ExpectationFailedException as PHPUnit57ExpectationFailedException;
1413
use PHPUnit\Framework\TestCase;
1514
use Traversable;
1615
use Zend\EventManager\EventManager;
@@ -194,13 +193,6 @@ public function testAssertListenerAtPriorityFailsWhenListenerIsNotFound()
194193
$arguments['event'],
195194
$arguments['priority']
196195
), $e->getMessage(), sprintf('Assertion failure message was unexpected: %s', $e->getMessage()));
197-
// for PHPUnit 5.7
198-
} catch (PHPUnit57ExpectationFailedException $e) {
199-
$this->assertContains(sprintf(
200-
'Listener not found for event "%s" and priority %d',
201-
$arguments['event'],
202-
$arguments['priority']
203-
), $e->getMessage(), sprintf('Assertion failure message was unexpected: %s', $e->getMessage()));
204196
}
205197
}
206198
}

test/_autoload.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/zend-component-installer for the canonical source repository
4+
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
5+
* @license https://github.com/zendframework/zend-component-installer/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
use PHPUnit\Framework\ExpectationFailedException;
9+
10+
class_alias('PHPUnit_Framework_ExpectationFailedException', ExpectationFailedException::class);

0 commit comments

Comments
 (0)