Skip to content

Commit

Permalink
Merge pull request #15 from Codeception/phpunit8
Browse files Browse the repository at this point in the history
Support PHPUnit 8
  • Loading branch information
Naktibalda authored Mar 2, 2019
2 parents f50bc27 + cd8dcbd commit 853657f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7
- 7.1
- 7.2
- 7.3

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
}
},
"require": {
"phpunit/phpunit": ">=4.8 <8.0"
"codeception/phpunit-wrapper": ">6.0.15 <6.1.0 | ^6.6.1 | ^7.7.1 | ^8.0.3"
}
}
9 changes: 5 additions & 4 deletions tests/StubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
require_once __DIR__ .'/ResetMocks.php';
use Codeception\Stub;

class StubTest extends \PHPUnit\Framework\TestCase
class StubTest extends \Codeception\PHPUnit\TestCase
{
use ResetMocks;
/**
* @var DummyClass
*/
protected $dummy;

public function setUp()
public function _setUp()
{
require_once $file = __DIR__. '/_data/DummyOverloadableClass.php';
require_once $file = __DIR__. '/_data/DummyClass.php';
Expand Down Expand Up @@ -241,7 +241,8 @@ public function testExpectedMethodIsCalledFail($stubMarshaler, $failMessage)
$mock->__phpunit_verify();
$this->fail('Expected exception');
} catch (\Exception $e) {
$this->assertContains($failMessage, $e->getMessage());
$this->assertTrue(strpos($failMessage, $e->getMessage()) >= 0, 'String contains');

}

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

$this->resetMockObjects();
Expand Down
8 changes: 4 additions & 4 deletions tests/StubTraitTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require_once __DIR__ .'/ResetMocks.php';

class StubTraitTest extends \PHPUnit\Framework\TestCase
class StubTraitTest extends \Codeception\PHPUnit\TestCase
{
use ResetMocks;
use \Codeception\Test\Feature\Stub;
Expand All @@ -10,7 +10,7 @@ class StubTraitTest extends \PHPUnit\Framework\TestCase
*/
protected $dummy;

public function setUp()
public function _setUp()
{
require_once $file = __DIR__. '/_data/DummyOverloadableClass.php';
require_once $file = __DIR__. '/_data/DummyClass.php';
Expand Down Expand Up @@ -61,10 +61,10 @@ public function testMakeMocks()
try {
$this->dummy->helloWorld();
} catch (Exception $e) {
$this->assertContains('was not expected to be called more than once', $e->getMessage());
$this->assertTrue(strpos('was not expected to be called more than once', $e->getMessage()) >= 0, 'String contains');
$this->resetMockObjects();
return;
}
$this->fail('No exception thrown');
}
}
}

0 comments on commit 853657f

Please sign in to comment.