Skip to content

Commit 5335193

Browse files
authored
Merge pull request #7 from gabriel-caruso/phpunit-6
Support PHPUnit 6 and PHPUnit Mock Objects 4
2 parents 8bb8290 + 61de566 commit 5335193

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

.travis.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
language: php
22

3+
sudo: false
4+
5+
notifications:
6+
email:
7+
on_success: never
8+
39
php:
4-
- 5.4
5-
- 5.5
6-
- 5.6
710
- 7.0
811
- 7.1
9-
- hhvm
12+
- nightly
1013

1114
matrix:
15+
fast_finish: true
16+
allow_failures:
17+
- php: nightly
1218
include:
13-
- php: 5.4
19+
- php: 7.0
1420
env: dependencies=lowest
1521

1622
before_script:
17-
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then composer require satooshi/php-coveralls:dev-master -n ; fi
18-
- if [[ "$TRAVIS_PHP_VERSION" != '5.6' ]]; then composer install -n ; fi
23+
- if [[ $(phpenv version-name) == '7.1' ]]; then composer require satooshi/php-coveralls:dev-master -n ; fi
24+
- if [[ $(phpenv version-name) != '7.1' ]]; then composer install -n ; fi
1925
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-stable -n; fi;
2026

2127
script:
22-
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi
23-
- if [[ "$TRAVIS_PHP_VERSION" != '5.6' ]]; then vendor/bin/phpunit ; fi
28+
- if [[ $(phpenv version-name) == '7.1' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi
29+
- if [[ $(phpenv version-name) != '7.1' ]]; then vendor/bin/phpunit ; fi
2430

2531
after_script:
26-
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then php vendor/bin/coveralls -v ; fi
32+
- if [[ $(phpenv version-name) == '7.1' ]]; then php vendor/bin/coveralls -v ; fi

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ composer require --dev mnapoli/phpunit-easymock
2121
To be able to use EasyMock in your tests **you must include the trait in your class**:
2222

2323
```php
24-
class MyTest extends \PHPUnit_Framework_TestCase
24+
class MyTest extends \PHPUnit\Framework\TestCase
2525
{
2626
use \EasyMock\EasyMock;
2727

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
}
1717
},
1818
"require": {
19-
"php": "~5.4|~7.0",
20-
"phpunit/phpunit-mock-objects": "~2.0|~3.0"
19+
"php": "~7.0",
20+
"phpunit/phpunit-mock-objects": "~4.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "~4.0|~5.0"
23+
"phpunit/phpunit": "~6.4"
2424
}
2525
}

tests/EasyMockTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
use EasyMock\Test\Fixture\ClassWithConstructor;
88
use EasyMock\Test\Fixture\CustomException;
99
use EasyMock\Test\Fixture\InterfaceFixture;
10+
use PHPUnit\Framework\TestCase;
11+
use PHPUnit\Framework\ExpectationFailedException;
1012

1113
/**
1214
* @author Matthieu Napoli <[email protected]>
1315
*/
14-
class EasyMockTest extends \PHPUnit_Framework_TestCase
16+
class EasyMockTest extends TestCase
1517
{
1618
use EasyMock;
1719

@@ -126,7 +128,7 @@ public function should_allow_to_spy_method_calls()
126128
));
127129

128130
// Test PHPUnit's internals to check that the spy was registered
129-
$property = new \ReflectionProperty('PHPUnit_Framework_TestCase', 'mockObjects');
131+
$property = new \ReflectionProperty('PHPUnit\Framework\TestCase', 'mockObjects');
130132
$property->setAccessible(true);
131133
$mockObjects = $property->getValue($this);
132134

@@ -137,7 +139,7 @@ public function should_allow_to_spy_method_calls()
137139
try {
138140
$mock->__phpunit_verify();
139141
$this->fail('Exception not thrown');
140-
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
142+
} catch (ExpectationFailedException $e) {
141143
$this->assertContains('Expected invocation at least once but it never occur', $e->getMessage());
142144
}
143145

0 commit comments

Comments
 (0)