mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-09 09:34:46 +02:00
update to phpunit8
This commit is contained in:
@ -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!'],
|
||||
|
@ -13,7 +13,7 @@ class VisitorTest extends TestCase
|
||||
*/
|
||||
private $visitor;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->visitor = new Visitor\RoleVisitor();
|
||||
}
|
||||
|
@ -24,11 +24,10 @@ class StaticFactoryTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testException()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
StaticFactory::factory('object');
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ class ServiceLocatorTest extends TestCase
|
||||
*/
|
||||
private $serviceLocator;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->serviceLocator = new ServiceLocator();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
544
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,9 +8,4 @@
|
||||
<directory suffix="Test.php">Structural/*/Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<blacklist>
|
||||
<directory>./vendor</directory>
|
||||
</blacklist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
Reference in New Issue
Block a user