Skip to content

Commit cd8dcbd

Browse files
DavertMikNaktibalda
authored andcommitted
Made tests compatible with PHPUnit 8 and earlier versions
1 parent 92021b0 commit cd8dcbd

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
64
- 5.6
75
- 7
86
- 7.1
97
- 7.2
8+
- 7.3
109

1110
cache:
1211
directories:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111
},
1212
"require": {
13-
"phpunit/phpunit": ">=4.8 <9.0"
13+
"codeception/phpunit-wrapper": ">6.0.15 <6.1.0 | ^6.6.1 | ^7.7.1 | ^8.0.3"
1414
}
1515
}

tests/StubTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
require_once __DIR__ .'/ResetMocks.php';
33
use Codeception\Stub;
44

5-
class StubTest extends \PHPUnit\Framework\TestCase
5+
class StubTest extends \Codeception\PHPUnit\TestCase
66
{
77
use ResetMocks;
88
/**
99
* @var DummyClass
1010
*/
1111
protected $dummy;
1212

13-
public function setUp()
13+
public function _setUp()
1414
{
1515
require_once $file = __DIR__. '/_data/DummyOverloadableClass.php';
1616
require_once $file = __DIR__. '/_data/DummyClass.php';
@@ -241,7 +241,8 @@ public function testExpectedMethodIsCalledFail($stubMarshaler, $failMessage)
241241
$mock->__phpunit_verify();
242242
$this->fail('Expected exception');
243243
} catch (\Exception $e) {
244-
$this->assertContains($failMessage, $e->getMessage());
244+
$this->assertTrue(strpos($failMessage, $e->getMessage()) >= 0, 'String contains');
245+
245246
}
246247

247248
$this->resetMockObjects();
@@ -255,7 +256,7 @@ public function testNeverExpectedMethodIsCalledFail()
255256
try {
256257
$mock->call();
257258
} catch (\Exception $e) {
258-
$this->assertContains('was not expected to be called', $e->getMessage());
259+
$this->assertTrue(strpos('was not expected to be called', $e->getMessage()) >= 0, 'String contains');
259260
}
260261

261262
$this->resetMockObjects();

tests/StubTraitTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require_once __DIR__ .'/ResetMocks.php';
33

4-
class StubTraitTest extends \PHPUnit\Framework\TestCase
4+
class StubTraitTest extends \Codeception\PHPUnit\TestCase
55
{
66
use ResetMocks;
77
use \Codeception\Test\Feature\Stub;
@@ -10,7 +10,7 @@ class StubTraitTest extends \PHPUnit\Framework\TestCase
1010
*/
1111
protected $dummy;
1212

13-
public function setUp()
13+
public function _setUp()
1414
{
1515
require_once $file = __DIR__. '/_data/DummyOverloadableClass.php';
1616
require_once $file = __DIR__. '/_data/DummyClass.php';
@@ -61,10 +61,10 @@ public function testMakeMocks()
6161
try {
6262
$this->dummy->helloWorld();
6363
} catch (Exception $e) {
64-
$this->assertContains('was not expected to be called more than once', $e->getMessage());
64+
$this->assertTrue(strpos('was not expected to be called more than once', $e->getMessage()) >= 0, 'String contains');
6565
$this->resetMockObjects();
6666
return;
6767
}
6868
$this->fail('No exception thrown');
6969
}
70-
}
70+
}

0 commit comments

Comments
 (0)