update to phpunit8

This commit is contained in:
Dominik Liebler
2019-08-17 23:05:15 +02:00
parent 78ffb07d9c
commit a73c253ffc
10 changed files with 321 additions and 263 deletions

View File

@ -15,7 +15,7 @@ class ChainTest extends TestCase
*/
private $chain;
protected function setUp()
protected function setUp(): void
{
$this->chain = new HttpInMemoryCacheHandler(
['/foo/bar?index=1' => 'Hello In Memory!'],

View File

@ -13,7 +13,7 @@ class VisitorTest extends TestCase
*/
private $visitor;
protected function setUp()
protected function setUp(): void
{
$this->visitor = new Visitor\RoleVisitor();
}

View File

@ -24,11 +24,10 @@ class StaticFactoryTest extends TestCase
);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testException()
{
$this->expectException(\InvalidArgumentException::class);
StaticFactory::factory('object');
}
}

View File

@ -17,7 +17,7 @@ class PostRepositoryTest extends TestCase
*/
private $repository;
protected function setUp()
protected function setUp(): void
{
$this->repository = new PostRepository(new InMemoryPersistence());
}
@ -27,12 +27,11 @@ class PostRepositoryTest extends TestCase
$this->assertEquals(1, $this->repository->generateId()->toInt());
}
/**
* @expectedException \OutOfBoundsException
* @expectedExceptionMessage Post with id 42 does not exist
*/
public function testThrowsExceptionWhenTryingToFindPostWhichDoesNotExist()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('Post with id 42 does not exist');
$this->repository->findById(PostId::fromInt(42));
}

View File

@ -14,7 +14,7 @@ class ServiceLocatorTest extends TestCase
*/
private $serviceLocator;
public function setUp()
public function setUp(): void
{
$this->serviceLocator = new ServiceLocator();
}

View File

@ -20,11 +20,10 @@ class DataMapperTest extends TestCase
$this->assertInstanceOf(User::class, $user);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testWillNotMapInvalidData()
{
$this->expectException(\InvalidArgumentException::class);
$storage = new StorageAdapter([]);
$mapper = new UserMapper($storage);

View File

@ -21,11 +21,10 @@ class RegistryTest extends TestCase
$this->assertInstanceOf(stdClass::class, $storedLogger);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testThrowsExceptionWhenTryingToSetInvalidKey()
{
$this->expectException(\InvalidArgumentException::class);
Registry::set('foobar', new stdClass());
}
@ -35,10 +34,11 @@ class RegistryTest extends TestCase
* injected class may easily be replaced by a mockup
*
* @runInSeparateProcess
* @expectedException \InvalidArgumentException
*/
public function testThrowsExceptionWhenTryingToGetNotSetKey()
{
$this->expectException(\InvalidArgumentException::class);
Registry::get(Registry::LOGGER);
}
}

View File

@ -13,7 +13,7 @@
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7",
"phpunit/phpunit": "^8",
"squizlabs/php_codesniffer": "^3"
},
"autoload": {

544
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,4 @@
<directory suffix="Test.php">Structural/*/Tests</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory>./vendor</directory>
</blacklist>
</filter>
</phpunit>