diff --git a/Neos.Cache/Tests/Functional/Backend/RedisBackendTest.php b/Neos.Cache/Tests/Functional/Backend/RedisBackendTest.php
index 98fde16834..8565b6b887 100644
--- a/Neos.Cache/Tests/Functional/Backend/RedisBackendTest.php
+++ b/Neos.Cache/Tests/Functional/Backend/RedisBackendTest.php
@@ -46,7 +46,7 @@ class RedisBackendTest extends BaseTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$phpredisVersion = phpversion('redis');
if (version_compare($phpredisVersion, '1.2.0', '<')) {
@@ -73,7 +73,7 @@ public function setUp()
*
* @return void
*/
- public function tearDown()
+ protected function tearDown(): void
{
if ($this->backend instanceof RedisBackend) {
$this->backend->flush();
diff --git a/Neos.Cache/Tests/Unit/Backend/AbstractBackendTest.php b/Neos.Cache/Tests/Unit/Backend/AbstractBackendTest.php
index 1443063830..5dc0396c82 100644
--- a/Neos.Cache/Tests/Unit/Backend/AbstractBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/AbstractBackendTest.php
@@ -31,7 +31,7 @@ class AbstractBackendTest extends BaseTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
class_exists(AbstractBackend::class);
$className = 'ConcreteBackend_' . md5(uniqid(mt_rand(), true));
diff --git a/Neos.Cache/Tests/Unit/Backend/ApcuBackendTest.php b/Neos.Cache/Tests/Unit/Backend/ApcuBackendTest.php
index c12806205f..3d862d5ac3 100644
--- a/Neos.Cache/Tests/Unit/Backend/ApcuBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/ApcuBackendTest.php
@@ -15,6 +15,7 @@
use Neos\Cache\Backend\ApcuBackend;
use Neos\Cache\EnvironmentConfiguration;
+use Neos\Cache\Exception;
use Neos\Cache\Tests\BaseTestCase;
use Neos\Cache\Frontend\FrontendInterface;
use Neos\Cache\Frontend\VariableFrontend;
@@ -31,7 +32,7 @@ class ApcuBackendTest extends BaseTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
if (ini_get('apc.enabled') == 0 || ini_get('apc.enable_cli') == 0) {
$this->markTestSkipped('APCu is disabled (for CLI).');
@@ -43,10 +44,10 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function setThrowsExceptionIfNoFrontEndHasBeenSet()
{
+ $this->expectException(Exception::class);
$backend = new ApcuBackend($this->getEnvironmentConfiguration(), []);
$data = 'Some data';
$identifier = 'MyIdentifier' . md5(uniqid(mt_rand(), true));
diff --git a/Neos.Cache/Tests/Unit/Backend/FileBackendTest.php b/Neos.Cache/Tests/Unit/Backend/FileBackendTest.php
index d309a6d091..605e4ff337 100644
--- a/Neos.Cache/Tests/Unit/Backend/FileBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/FileBackendTest.php
@@ -15,11 +15,14 @@
use Neos\Cache\Backend\FileBackend;
use Neos\Cache\EnvironmentConfiguration;
+use Neos\Cache\Exception;
use Neos\Cache\Tests\BaseTestCase;
use org\bovigo\vfs\vfsStream;
use Neos\Cache\Frontend\AbstractFrontend;
use Neos\Cache\Frontend\PhpFrontend;
use Neos\Cache\Frontend\VariableFrontend;
+use PHPUnit\Framework\Error\Notice;
+use PHPUnit\Framework\Error\Warning;
/**
* Test case for the cache to file backend
@@ -28,17 +31,17 @@ class FileBackendTest extends BaseTestCase
{
/**
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
}
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function setCacheThrowsExceptionOnNonWritableDirectory()
{
+ $this->expectException(Exception::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockEnvironmentConfiguration = $this->createEnvironmentConfigurationMock([__DIR__ . '~Testing', 'http://localhost/', PHP_MAXPATHLEN]);
@@ -183,11 +186,11 @@ public function setAlsoSavesSpecifiedTags()
/**
* @test
- * @expectedException \Neos\Cache\Exception
- * @expectedExceptionCode 1248710426
*/
public function setThrowsExceptionIfCachePathLengthExceedsMaximumPathLength()
{
+ $this->expectExceptionCode(1248710426);
+ $this->expectException(Exception::class);
$cachePath = 'vfs://Foo';
$mockEnvironmentConfiguration = $this->createEnvironmentConfigurationMock([
@@ -427,10 +430,10 @@ public function invalidEntryIdentifiers()
/**
* @test
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function setThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
$backend = $this->prepareDefaultBackend();
@@ -442,10 +445,10 @@ public function setThrowsExceptionForInvalidIdentifier($identifier)
/**
* @test
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function getThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
@@ -458,10 +461,10 @@ public function getThrowsExceptionForInvalidIdentifier($identifier)
/**
* @test
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function hasThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$backend = $this->prepareDefaultBackend(['dummy']);
$backend->has($identifier);
@@ -470,10 +473,10 @@ public function hasThrowsExceptionForInvalidIdentifier($identifier)
/**
* @test
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function removeThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
@@ -486,10 +489,10 @@ public function removeThrowsExceptionForInvalidIdentifier($identifier)
/**
* @test
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function requireOnceThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
@@ -543,10 +546,10 @@ public function requireOnceDoesNotCheckExpiryTimeIfBackendIsFrozen()
/**
* @test
- * @expectedException \Exception
*/
public function requireOnceDoesNotSwallowExceptionsOfTheIncludedFile()
{
+ $this->expectException(\Exception::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
@@ -560,10 +563,10 @@ public function requireOnceDoesNotSwallowExceptionsOfTheIncludedFile()
/**
* @test
- * @expectedException \PHPUnit\Framework\Error\Warning
*/
public function requireOnceDoesNotSwallowPhpWarningsOfTheIncludedFile()
{
+ $this->expectException(Warning::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
@@ -577,10 +580,10 @@ public function requireOnceDoesNotSwallowPhpWarningsOfTheIncludedFile()
/**
* @test
- * @expectedException \PHPUnit\Framework\Error\Notice
*/
public function requireOnceDoesNotSwallowPhpNoticesOfTheIncludedFile()
{
+ $this->expectException(Notice::class);
$mockCache = $this->createMock(AbstractFrontend::class);
$mockCache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('UnitTestCache'));
@@ -611,7 +614,7 @@ public function findIdentifiersByTagFindsCacheEntriesWithSpecifiedTag()
$expectedEntry = 'BackendFileTest2';
$actualEntries = $backend->findIdentifiersByTag('UnitTestTag%special');
- $this->assertInternalType('array', $actualEntries);
+ $this->assertIsArray($actualEntries);
$this->assertEquals($expectedEntry, array_pop($actualEntries));
}
diff --git a/Neos.Cache/Tests/Unit/Backend/MemcachedBackendTest.php b/Neos.Cache/Tests/Unit/Backend/MemcachedBackendTest.php
index c887cf5a55..857a0f6d61 100644
--- a/Neos.Cache/Tests/Unit/Backend/MemcachedBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/MemcachedBackendTest.php
@@ -15,6 +15,7 @@
use Neos\Cache\Backend\MemcachedBackend;
use Neos\Cache\EnvironmentConfiguration;
+use Neos\Cache\Exception;
use Neos\Cache\Tests\BaseTestCase;
use Neos\Cache\Frontend\AbstractFrontend;
use Neos\Cache\Frontend\FrontendInterface;
@@ -31,7 +32,7 @@ class MemcachedBackendTest extends BaseTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
try {
if (!@fsockopen('localhost', 11211)) {
@@ -44,10 +45,10 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function setThrowsExceptionIfNoFrontEndHasBeenSet()
{
+ $this->expectException(Exception::class);
$backendOptions = ['servers' => ['localhost:11211']];
$backend = new MemcachedBackend($this->getEnvironmentConfiguration(), $backendOptions);
$data = 'Some data';
@@ -57,19 +58,19 @@ public function setThrowsExceptionIfNoFrontEndHasBeenSet()
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function initializeObjectThrowsExceptionIfNoMemcacheServerIsConfigured()
{
+ $this->expectException(Exception::class);
$backend = new MemcachedBackend($this->getEnvironmentConfiguration(), []);
}
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function setThrowsExceptionIfConfiguredServersAreUnreachable()
{
+ $this->expectException(Exception::class);
$backend = $this->setUpBackend(['servers' => ['localhost:11212']]);
$data = 'Somedata';
$identifier = 'MyIdentifier' . md5(uniqid(mt_rand(), true));
diff --git a/Neos.Cache/Tests/Unit/Backend/MultiBackendTest.php b/Neos.Cache/Tests/Unit/Backend/MultiBackendTest.php
index bc2625abe1..f77f84b656 100644
--- a/Neos.Cache/Tests/Unit/Backend/MultiBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/MultiBackendTest.php
@@ -39,10 +39,10 @@ public function noExceptionIsThrownIfBackendFailsToBeCreated()
/**
* @test
- * @expectedException \Throwable
*/
public function debugModeWillBubbleExceptions()
{
+ $this->expectException(\Throwable::class);
$backendOptions = [
'debug' => true,
'backendConfigurations' => [
diff --git a/Neos.Cache/Tests/Unit/Backend/PdoBackendTest.php b/Neos.Cache/Tests/Unit/Backend/PdoBackendTest.php
index 5c9256b52a..e6580fbfb9 100644
--- a/Neos.Cache/Tests/Unit/Backend/PdoBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/PdoBackendTest.php
@@ -15,6 +15,7 @@
use Neos\Cache\Backend\PdoBackend;
use Neos\Cache\EnvironmentConfiguration;
+use Neos\Cache\Exception;
use Neos\Cache\Frontend\FrontendInterface;
use Neos\Cache\Tests\BaseTestCase;
use PHPUnit\Framework\MockObject\MockObject;
@@ -38,10 +39,10 @@ class PdoBackendTest extends BaseTestCase
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function setThrowsExceptionIfNoFrontEndHasBeenSet()
{
+ $this->expectException(Exception::class);
$backend = new PdoBackend(new EnvironmentConfiguration('SomeApplication Testing', '/some/path', PHP_MAXPATHLEN));
$data = 'Some data';
$identifier = 'MyIdentifier';
diff --git a/Neos.Cache/Tests/Unit/Backend/RedisBackendTest.php b/Neos.Cache/Tests/Unit/Backend/RedisBackendTest.php
index 94a3ad2ea0..025156ea6b 100644
--- a/Neos.Cache/Tests/Unit/Backend/RedisBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/RedisBackendTest.php
@@ -45,7 +45,7 @@ class RedisBackendTest extends BaseTestCase
* Set up test case
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$phpredisVersion = phpversion('redis');
if (version_compare($phpredisVersion, '1.2.0', '<')) {
@@ -194,11 +194,11 @@ public function hasInvokesRedis()
/**
* @test
* @dataProvider writingOperationsProvider
- * @expectedException \RuntimeException
* @param string $method
*/
public function writingOperationsThrowAnExceptionIfCacheIsFrozen($method)
{
+ $this->expectException(\RuntimeException::class);
$this->inject($this->backend, 'frozen', null);
$this->redis->expects($this->once())
->method('exists')
diff --git a/Neos.Cache/Tests/Unit/Backend/SimpleFileBackendTest.php b/Neos.Cache/Tests/Unit/Backend/SimpleFileBackendTest.php
index f9c4d98420..8ac64df138 100644
--- a/Neos.Cache/Tests/Unit/Backend/SimpleFileBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/SimpleFileBackendTest.php
@@ -15,10 +15,13 @@
use Neos\Cache\Backend\SimpleFileBackend;
use Neos\Cache\EnvironmentConfiguration;
+use Neos\Cache\Exception;
use Neos\Cache\Tests\BaseTestCase;
use org\bovigo\vfs\vfsStream;
use Neos\Cache\Frontend\FrontendInterface;
use Neos\Cache\Frontend\PhpFrontend;
+use PHPUnit\Framework\Error\Notice;
+use PHPUnit\Framework\Error\Warning;
/**
* Test case for the SimpleFileBackend
@@ -38,7 +41,7 @@ class SimpleFileBackendTest extends BaseTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Temporary/Directory/');
@@ -75,10 +78,10 @@ protected function getSimpleFileBackend(array $options = [], FrontendInterface $
/**
* @test
- * @expectedException \Neos\Cache\Exception
*/
public function setCacheThrowsExceptionOnNonWritableDirectory()
{
+ $this->expectException(Exception::class);
$mockEnvironmentConfiguration = $this->getMockBuilder(EnvironmentConfiguration::class)
->setMethods(null)
->setConstructorArgs([
@@ -95,11 +98,11 @@ public function setCacheThrowsExceptionOnNonWritableDirectory()
/**
* @test
- * @expectedException \Neos\Cache\Exception
- * @expectedExceptionCode 1248710426
*/
public function setThrowsExceptionIfCachePathLengthExceedsMaximumPathLength()
{
+ $this->expectException(Exception::class);
+ $this->expectExceptionCode(1248710426);
$mockEnvironmentConfiguration = new EnvironmentConfiguration(
__DIR__ . '~Testing',
'vfs://Temporary/Directory/',
@@ -310,10 +313,10 @@ public function invalidEntryIdentifiers()
* @test
* @param string $identifier
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function setThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$simpleFileBackend = $this->getSimpleFileBackend();
$simpleFileBackend->set($identifier, 'some data');
}
@@ -322,10 +325,10 @@ public function setThrowsExceptionForInvalidIdentifier($identifier)
* @test
* @param string $identifier
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function getThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$simpleFileBackend = $this->getSimpleFileBackend();
$simpleFileBackend->get($identifier);
}
@@ -334,10 +337,10 @@ public function getThrowsExceptionForInvalidIdentifier($identifier)
* @test
* @param string $identifier
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function hasThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$simpleFileBackend = $this->getSimpleFileBackend();
$simpleFileBackend->has($identifier);
}
@@ -346,10 +349,10 @@ public function hasThrowsExceptionForInvalidIdentifier($identifier)
* @test
* @param string $identifier
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function removeThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$simpleFileBackend = $this->getSimpleFileBackend();
$simpleFileBackend->remove($identifier);
}
@@ -358,10 +361,10 @@ public function removeThrowsExceptionForInvalidIdentifier($identifier)
* @test
* @param string $identifier
* @dataProvider invalidEntryIdentifiers
- * @expectedException \InvalidArgumentException
*/
public function requireOnceThrowsExceptionForInvalidIdentifier($identifier)
{
+ $this->expectException(\InvalidArgumentException::class);
$simpleFileBackend = $this->getSimpleFileBackend();
$simpleFileBackend->requireOnce($identifier);
}
@@ -384,10 +387,10 @@ public function requireOnceIncludesAndReturnsResultOfIncludedPhpFile()
/**
* @test
- * @expectedException \Exception
*/
public function requireOnceDoesNotSwallowExceptionsOfTheIncludedFile()
{
+ $this->expectException(\Exception::class);
$entryIdentifier = 'SomePhpEntryWithException';
$simpleFileBackend = $this->getSimpleFileBackend();
@@ -397,10 +400,10 @@ public function requireOnceDoesNotSwallowExceptionsOfTheIncludedFile()
/**
* @test
- * @expectedException \PHPUnit\Framework\Error\Warning
*/
public function requireOnceDoesNotSwallowPhpWarningsOfTheIncludedFile()
{
+ $this->expectException(Warning::class);
$entryIdentifier = 'SomePhpEntryWithPhpWarning';
$simpleFileBackend = $this->getSimpleFileBackend();
@@ -410,10 +413,10 @@ public function requireOnceDoesNotSwallowPhpWarningsOfTheIncludedFile()
/**
* @test
- * @expectedException \PHPUnit\Framework\Error\Notice
*/
public function requireOnceDoesNotSwallowPhpNoticesOfTheIncludedFile()
{
+ $this->expectException(Notice::class);
$entryIdentifier = 'SomePhpEntryWithPhpNotice';
$simpleFileBackend = $this->getSimpleFileBackend();
diff --git a/Neos.Cache/Tests/Unit/Backend/TransientMemoryBackendTest.php b/Neos.Cache/Tests/Unit/Backend/TransientMemoryBackendTest.php
index b4b790456d..0abf0f5750 100644
--- a/Neos.Cache/Tests/Unit/Backend/TransientMemoryBackendTest.php
+++ b/Neos.Cache/Tests/Unit/Backend/TransientMemoryBackendTest.php
@@ -15,6 +15,7 @@
use Neos\Cache\Backend\TransientMemoryBackend;
use Neos\Cache\EnvironmentConfiguration;
+use Neos\Cache\Exception;
use Neos\Cache\Tests\BaseTestCase;
use Neos\Cache\Frontend\FrontendInterface;
@@ -25,11 +26,11 @@
class TransientMemoryBackendTest extends BaseTestCase
{
/**
- * @expectedException \Neos\Cache\Exception
* @test
*/
public function setThrowsExceptionIfNoFrontEndHasBeenSet()
{
+ $this->expectException(Exception::class);
$backend = new TransientMemoryBackend($this->getEnvironmentConfiguration());
$data = 'Some data';
diff --git a/Neos.Cache/Tests/Unit/Frontend/AbstractFrontendTest.php b/Neos.Cache/Tests/Unit/Frontend/AbstractFrontendTest.php
index f7b8094d6f..27ef148f0c 100644
--- a/Neos.Cache/Tests/Unit/Frontend/AbstractFrontendTest.php
+++ b/Neos.Cache/Tests/Unit/Frontend/AbstractFrontendTest.php
@@ -26,7 +26,7 @@ class AbstractFrontendTest extends BaseTestCase
/** @var AbstractBackend */
protected $mockBackend;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->mockBackend = $this->getMockBuilder(AbstractBackend::class)->setMethods(['get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'])->disableOriginalConstructor()->getMock();
@@ -77,10 +77,10 @@ public function flushCallsBackend()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function flushByTagRejectsInvalidTags()
{
+ $this->expectException(\InvalidArgumentException::class);
$identifier = 'someCacheIdentifier';
$backend = $this->createMock(TaggableBackendInterface::class);
$backend->expects($this->never())->method('flushByTag');
diff --git a/Neos.Cache/Tests/Unit/Frontend/PhpFrontendTest.php b/Neos.Cache/Tests/Unit/Frontend/PhpFrontendTest.php
index ec8ab6bce3..45d43df4c7 100644
--- a/Neos.Cache/Tests/Unit/Frontend/PhpFrontendTest.php
+++ b/Neos.Cache/Tests/Unit/Frontend/PhpFrontendTest.php
@@ -12,6 +12,8 @@
* information, please view the LICENSE file which was distributed with this
* source code.
*/
+
+use Neos\Cache\Exception\InvalidDataException;
use Neos\Cache\Tests\BaseTestCase;
use Neos\Cache\Backend\PhpCapableBackendInterface;
use Neos\Cache\Frontend\PhpFrontend;
@@ -24,11 +26,11 @@
class PhpFrontendTest extends BaseTestCase
{
/**
- * @expectedException \InvalidArgumentException
* @test
*/
public function setChecksIfTheIdentifierIsValid()
{
+ $this->expectException(\InvalidArgumentException::class);
$cache = $this->getMockBuilder(StringFrontend::class)
->setMethods(['isValidEntryIdentifier'])
->disableOriginalConstructor()
@@ -58,10 +60,10 @@ public function setPassesPhpSourceCodeTagsAndLifetimeToBackend()
/**
* @test
- * @expectedException \Neos\Cache\Exception\InvalidDataException
*/
public function setThrowsInvalidDataExceptionOnNonStringValues()
{
+ $this->expectException(InvalidDataException::class);
$cache = $this->getMockBuilder(PhpFrontend::class)
->setMethods(null)
->disableOriginalConstructor()
diff --git a/Neos.Cache/Tests/Unit/Frontend/StringFrontendTest.php b/Neos.Cache/Tests/Unit/Frontend/StringFrontendTest.php
index 54662da05b..a57bc152b4 100644
--- a/Neos.Cache/Tests/Unit/Frontend/StringFrontendTest.php
+++ b/Neos.Cache/Tests/Unit/Frontend/StringFrontendTest.php
@@ -15,6 +15,8 @@
use Neos\Cache\Backend\AbstractBackend;
use Neos\Cache\Backend\NullBackend;
use Neos\Cache\Backend\TaggableBackendInterface;
+use Neos\Cache\Exception\InvalidDataException;
+use Neos\Cache\Exception\NotSupportedByBackendException;
use Neos\Cache\Frontend\StringFrontend;
use Neos\Cache\Tests\BaseTestCase;
@@ -25,11 +27,11 @@
class StringFrontendTest extends BaseTestCase
{
/**
- * @expectedException \InvalidArgumentException
* @test
*/
public function setChecksIfTheIdentifierIsValid()
{
+ $this->expectException(\InvalidArgumentException::class);
$cache = $this->getMockBuilder(StringFrontend::class)
->setMethods(['isValidEntryIdentifier'])
->disableOriginalConstructor()
@@ -68,10 +70,10 @@ public function setPassesLifetimeToBackend()
/**
* @test
- * @expectedException \Neos\Cache\Exception\InvalidDataException
*/
public function setThrowsInvalidDataExceptionOnNonStringValues()
{
+ $this->expectException(InvalidDataException::class);
$backend = $this->prepareDefaultBackend();
$cache = new StringFrontend('StringFrontend', $backend);
@@ -119,10 +121,10 @@ public function removeCallsBackend()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function getByTagRejectsInvalidTags()
{
+ $this->expectException(\InvalidArgumentException::class);
$backend = $this->createMock(TaggableBackendInterface::class);
$backend->expects($this->never())->method('findIdentifiersByTag');
@@ -132,10 +134,10 @@ public function getByTagRejectsInvalidTags()
/**
* @test
- * @expectedException \Neos\Cache\Exception\NotSupportedByBackendException
*/
public function getByTagThrowAnExceptionWithoutTaggableBackend()
{
+ $this->expectException(NotSupportedByBackendException::class);
$backend = $this->prepareDefaultBackend();
$cache = new StringFrontend('VariableFrontend', $backend);
$cache->getByTag('foo');
diff --git a/Neos.Cache/Tests/Unit/Frontend/VariableFrontendTest.php b/Neos.Cache/Tests/Unit/Frontend/VariableFrontendTest.php
index 4d05ced6a6..fe92b9aa3b 100644
--- a/Neos.Cache/Tests/Unit/Frontend/VariableFrontendTest.php
+++ b/Neos.Cache/Tests/Unit/Frontend/VariableFrontendTest.php
@@ -14,6 +14,7 @@
*/
use Neos\Cache\Backend\AbstractBackend;
use Neos\Cache\Backend\NullBackend;
+use Neos\Cache\Exception\NotSupportedByBackendException;
use Neos\Cache\Tests\BaseTestCase;
use Neos\Cache\Backend\TaggableBackendInterface;
use Neos\Cache\Frontend\StringFrontend;
@@ -26,11 +27,11 @@
class VariableFrontendTest extends BaseTestCase
{
/**
- * @expectedException \InvalidArgumentException
* @test
*/
public function setChecksIfTheIdentifierIsValid()
{
+ $this->expectException(\InvalidArgumentException::class);
$cache = $this->getMockBuilder(StringFrontend::class)
->setMethods(['isValidEntryIdentifier'])
->disableOriginalConstructor()
@@ -175,10 +176,10 @@ public function removeCallsBackend()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function getByTagRejectsInvalidTags()
{
+ $this->expectException(\InvalidArgumentException::class);
$backend = $this->createMock(TaggableBackendInterface::class);
$backend->expects($this->never())->method('findIdentifiersByTag');
@@ -188,10 +189,10 @@ public function getByTagRejectsInvalidTags()
/**
* @test
- * @expectedException \Neos\Cache\Exception\NotSupportedByBackendException
*/
public function getByTagThrowAnExceptionWithoutTaggableBackend()
{
+ $this->expectException(NotSupportedByBackendException::class);
$backend = $this->prepareDefaultBackend();
$cache = new VariableFrontend('VariableFrontend', $backend);
$cache->getByTag('foo');
diff --git a/Neos.Cache/Tests/Unit/Psr/Cache/CachePoolTest.php b/Neos.Cache/Tests/Unit/Psr/Cache/CachePoolTest.php
index db6e0403d3..f7442cc3ad 100644
--- a/Neos.Cache/Tests/Unit/Psr/Cache/CachePoolTest.php
+++ b/Neos.Cache/Tests/Unit/Psr/Cache/CachePoolTest.php
@@ -14,6 +14,7 @@
use Neos\Cache\Backend\AbstractBackend;
use Neos\Cache\Psr\Cache\CachePool;
use Neos\Cache\Psr\Cache\CacheItem;
+use Neos\Cache\Psr\InvalidArgumentException;
use Neos\Cache\Tests\BaseTestCase;
/**
@@ -23,11 +24,11 @@
class CachePoolTest extends BaseTestCase
{
/**
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
* @test
*/
public function getItemChecksIfTheIdentifierIsValid()
{
+ $this->expectException(InvalidArgumentException::class);
/** @var PsrFrontend|\PHPUnit_Framework_MockObject_MockObject $cache */
$cache = $this->getMockBuilder(CachePool::class)
->setMethods(['isValidEntryIdentifier'])
diff --git a/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheFactoryTest.php b/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheFactoryTest.php
index 371000c34a..b9238638d6 100644
--- a/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheFactoryTest.php
+++ b/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheFactoryTest.php
@@ -21,7 +21,7 @@ class SimpleCacheFactoryTest extends BaseTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Temporary/Directory/');
diff --git a/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheTest.php b/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheTest.php
index ca347f4069..58780d6a2b 100644
--- a/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheTest.php
+++ b/Neos.Cache/Tests/Unit/Psr/SimpleCache/SimpleCacheTest.php
@@ -3,6 +3,7 @@
use Neos\Cache\Backend\BackendInterface;
use Neos\Cache\Exception;
+use Neos\Cache\Psr\InvalidArgumentException;
use Neos\Cache\Psr\SimpleCache\SimpleCache;
use Neos\Cache\Tests\BaseTestCase;
@@ -19,7 +20,7 @@ class SimpleCacheTest extends BaseTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockBackend = $this->getMockBuilder(BackendInterface::class)->getMock();
}
@@ -35,29 +36,29 @@ protected function createSimpleCache($identifier = 'SimpleCacheTest')
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function constructingWithInvalidIdentifierThrowsPsrInvalidArgumentException()
{
+ $this->expectException(InvalidArgumentException::class);
$this->createSimpleCache('Invalid #*<>/()=?!');
}
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function setThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->set('Invalid #*<>/()=?!', 'does not matter');
}
/**
* @test
- * @expectedException Exception
*/
public function setThrowsExceptionOnBackendError()
{
+ $this->expectException(Exception::class);
$this->mockBackend->expects(self::any())->method('set')->willThrowException(new Exception\InvalidDataException('Some other exception', 1234));
$simpleCache = $this->createSimpleCache();
$simpleCache->set('validkey', 'valid data');
@@ -76,20 +77,20 @@ public function setWillSetInBackendAndReturnBackendResponse()
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function getThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->get('Invalid #*<>/()=?!', false);
}
/**
* @test
- * @expectedException Exception
*/
public function getThrowsExceptionOnBackendError()
{
+ $this->expectException(Exception::class);
$this->mockBackend->expects(self::any())->method('get')->willThrowException(new Exception\InvalidDataException('Some other exception', 1234));
$simpleCache = $this->createSimpleCache();
$simpleCache->get('validkey', false);
@@ -122,20 +123,20 @@ public function getReturnsBackendResponseAfterUnserialising()
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function deleteThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->delete('Invalid #*<>/()=?!');
}
/**
* @test
- * @expectedException Exception
*/
public function deleteThrowsExceptionOnBackendError()
{
+ $this->expectException(Exception::class);
$this->mockBackend->expects(self::any())->method('remove')->willThrowException(new Exception\InvalidDataException('Some other exception', 1234));
$simpleCache = $this->createSimpleCache();
$simpleCache->delete('validkey');
@@ -143,10 +144,10 @@ public function deleteThrowsExceptionOnBackendError()
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function getMultipleThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->getMultiple(['validKey', 'Invalid #*<>/()=?!']);
}
@@ -181,10 +182,10 @@ public function getMultipleFillsWithDefault()
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function setMultipleThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->setMultiple(['validKey' => 'value', 'Invalid #*<>/()=?!' => 'value']);
}
@@ -208,20 +209,20 @@ public function setMultipleReturnsResult()
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function deleteMultipleThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->deleteMultiple(['validKey', 'Invalid #*<>/()=?!']);
}
/**
* @test
- * @expectedException \Neos\Cache\Psr\InvalidArgumentException
*/
public function hasThrowsInvalidArgumentExceptionOnInvalidIdentifier()
{
+ $this->expectException(InvalidArgumentException::class);
$simpleCache = $this->createSimpleCache();
$simpleCache->has('Invalid #*<>/()=?!');
}
diff --git a/Neos.Cache/composer.json b/Neos.Cache/composer.json
index 238b6e4e65..3c874c1aaa 100644
--- a/Neos.Cache/composer.json
+++ b/Neos.Cache/composer.json
@@ -14,7 +14,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Eel/Tests/Functional/FlowQuery/OperationResolverTest.php b/Neos.Eel/Tests/Functional/FlowQuery/OperationResolverTest.php
index db5fc3c1ec..d62bb57e75 100644
--- a/Neos.Eel/Tests/Functional/FlowQuery/OperationResolverTest.php
+++ b/Neos.Eel/Tests/Functional/FlowQuery/OperationResolverTest.php
@@ -16,7 +16,7 @@ class OperationResolverTest extends FunctionalTestCase
protected $operationResolver;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->operationResolver = $this->objectManager->get(OperationResolver::class);
diff --git a/Neos.Eel/Tests/Unit/AbstractEvaluatorTest.php b/Neos.Eel/Tests/Unit/AbstractEvaluatorTest.php
index 4c627e2afa..9ec2e6729a 100644
--- a/Neos.Eel/Tests/Unit/AbstractEvaluatorTest.php
+++ b/Neos.Eel/Tests/Unit/AbstractEvaluatorTest.php
@@ -13,6 +13,8 @@
use Neos\Eel\Context;
use Neos\Eel\EelEvaluatorInterface;
+use Neos\Eel\EvaluationException;
+use Neos\Eel\ParserException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -570,10 +572,10 @@ public function methodCallExpressionsCanBeParsed($expression, $context, $result)
/**
* @test
- * @expectedException \Neos\Eel\EvaluationException
*/
public function methodCallOfUndefinedFunctionThrowsException()
{
+ $this->expectException(EvaluationException::class);
$c = new Context([
'arr' => [
'func' => function ($arg) {
@@ -586,10 +588,10 @@ public function methodCallOfUndefinedFunctionThrowsException()
/**
* @test
- * @expectedException \Neos\Eel\EvaluationException
*/
public function methodCallOfUnknownMethodThrowsException()
{
+ $this->expectException(EvaluationException::class);
$o = new \Neos\Eel\Tests\Unit\Fixtures\TestObject();
$c = new Context([
@@ -671,10 +673,10 @@ public function invalidExpressions()
/**
* @test
* @dataProvider invalidExpressions
- * @expectedException \Neos\Eel\ParserException
*/
public function invalidExpressionsThrowExceptions($expression)
{
+ $this->expectException(ParserException::class);
$this->assertEvaluated(false, $expression, new Context());
}
diff --git a/Neos.Eel/Tests/Unit/FlowQuery/FlowQueryTest.php b/Neos.Eel/Tests/Unit/FlowQuery/FlowQueryTest.php
index 634b1a7be5..fdcdf20488 100644
--- a/Neos.Eel/Tests/Unit/FlowQuery/FlowQueryTest.php
+++ b/Neos.Eel/Tests/Unit/FlowQuery/FlowQueryTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Eel\FlowQuery\FizzleException;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Eel\FlowQuery\OperationResolver;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
@@ -578,10 +579,11 @@ public function dataProviderForErrorQueries()
/**
* @dataProvider dataProviderForErrorQueries
* @test
- * @expectedException \Neos\Eel\FlowQuery\FizzleException
*/
public function errorQueriesThrowError($expression)
{
+ $this->expectException(FizzleException::class);
+
$x = new \stdClass();
$x->foo = new \stdClass();
$x->foo->foo = 'asdf';
diff --git a/Neos.Eel/Tests/Unit/Helper/DateHelperTest.php b/Neos.Eel/Tests/Unit/Helper/DateHelperTest.php
index 7958409eff..a9f6d7c2fa 100644
--- a/Neos.Eel/Tests/Unit/Helper/DateHelperTest.php
+++ b/Neos.Eel/Tests/Unit/Helper/DateHelperTest.php
@@ -41,7 +41,7 @@ public function parseWorks($string, $format, $expected)
$helper = new DateHelper();
$result = $helper->parse($string, $format);
$this->assertInstanceOf(\DateTime::class, $result);
- $this->assertEquals((float)$expected->format('U'), (float)$result->format('U'), 'Timestamps should match', 60);
+ $this->assertEqualsWithDelta((float)$expected->format('U'), (float)$result->format('U'), 60, 'Timestamps should match');
}
/**
@@ -132,7 +132,7 @@ public function nowWorks()
$helper = new DateHelper();
$result = $helper->now();
$this->assertInstanceOf(\DateTime::class, $result);
- $this->assertEquals(time(), (integer)$result->format('U'), 'Now should be now', 1);
+ $this->assertEqualsWithDelta(time(), (integer)$result->format('U'), 1, 'Now should be now');
}
/**
@@ -144,7 +144,7 @@ public function createWorks()
$result = $helper->create('yesterday noon');
$expected = new \DateTime('yesterday noon');
$this->assertInstanceOf(\DateTime::class, $result);
- $this->assertEquals($expected->getTimestamp(), $result->getTimestamp(), 'Created DateTime object should match expected', 1);
+ $this->assertEqualsWithDelta($expected->getTimestamp(), $result->getTimestamp(), 1, 'Created DateTime object should match expected');
}
/**
@@ -156,7 +156,7 @@ public function todayWorks()
$result = $helper->today();
$this->assertInstanceOf(\DateTime::class, $result);
$today = new \DateTime('today');
- $this->assertEquals($today->getTimestamp(), $result->getTimestamp(), 'Today should be today', 1);
+ $this->assertEqualsWithDelta($today->getTimestamp(), $result->getTimestamp(), 1, 'Today should be today');
}
/**
diff --git a/Neos.Eel/Tests/Unit/Helper/FileHelperTest.php b/Neos.Eel/Tests/Unit/Helper/FileHelperTest.php
index 26f53d26c8..3852ddccc1 100644
--- a/Neos.Eel/Tests/Unit/Helper/FileHelperTest.php
+++ b/Neos.Eel/Tests/Unit/Helper/FileHelperTest.php
@@ -20,7 +20,7 @@
*/
class FileHelperTest extends UnitTestCase
{
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
}
diff --git a/Neos.Eel/Tests/Unit/Helper/MathHelperTest.php b/Neos.Eel/Tests/Unit/Helper/MathHelperTest.php
index 2ae15b72e0..56eb640050 100644
--- a/Neos.Eel/Tests/Unit/Helper/MathHelperTest.php
+++ b/Neos.Eel/Tests/Unit/Helper/MathHelperTest.php
@@ -46,7 +46,7 @@ public function roundWorks($value, $precision, $expected)
if ($expected === static::NAN) {
$this->assertTrue(is_nan($result), 'Expected NAN');
} else {
- $this->assertEquals($expected, $result, 'Rounded value did not match', 0.0001);
+ $this->assertEqualsWithDelta($expected, $result, 0.0001, 'Rounded value did not match');
}
}
@@ -76,7 +76,7 @@ public function constantsWorks($method, $expected)
'Math' => $helper
]);
$result = $evaluator->evaluate($method, $context);
- $this->assertEquals($expected, $result, 'Rounded value did not match', 0.001);
+ $this->assertEqualsWithDelta($expected, $result, 0.001, 'Rounded value did not match');
}
public function trigonometricExamples()
@@ -110,7 +110,7 @@ public function trigonometricFunctionsWork($method, $expected)
'Math' => $helper
]);
$result = $evaluator->evaluate($method, $context);
- $this->assertEquals($expected, $result, 'Rounded value did not match', 0.001);
+ $this->assertEqualsWithDelta($expected, $result, 0.001, 'Rounded value did not match');
}
public function variousExamples()
@@ -213,7 +213,7 @@ public function variousFunctionsWork($method, $expected)
if ($expected === static::NAN) {
$this->assertTrue(is_nan($result), 'Expected NAN, got value "' . $result . '"');
} else {
- $this->assertEquals($expected, $result, 'Rounded value did not match', 0.001);
+ $this->assertEqualsWithDelta($expected, $result, 0.001, 'Rounded value did not match');
}
}
diff --git a/Neos.Eel/Tests/Unit/ProtectedContextTest.php b/Neos.Eel/Tests/Unit/ProtectedContextTest.php
index fddfd7124c..f8a069462b 100644
--- a/Neos.Eel/Tests/Unit/ProtectedContextTest.php
+++ b/Neos.Eel/Tests/Unit/ProtectedContextTest.php
@@ -13,6 +13,7 @@
use Neos\Cache\Frontend\StringFrontend;
use Neos\Eel\CompilingEvaluator;
+use Neos\Eel\NotAllowedException;
use Neos\Eel\ProtectedContext;
use Neos\Eel\Tests\Unit\Fixtures\TestObject;
use Neos\Flow\Tests\UnitTestCase;
@@ -24,10 +25,10 @@ class ProtectedContextTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Eel\NotAllowedException
*/
public function methodCallToAnyValueIsNotAllowed()
{
+ $this->expectException(NotAllowedException::class);
$securedObject = new TestObject();
$context = new ProtectedContext([
@@ -40,10 +41,10 @@ public function methodCallToAnyValueIsNotAllowed()
/**
* @test
- * @expectedException \Neos\Eel\NotAllowedException
*/
public function arrayAccessResultIsStillUntrusted()
{
+ $this->expectException(NotAllowedException::class);
$securedObject = new TestObject();
$context = new ProtectedContext([
@@ -92,10 +93,10 @@ public function methodCallToWhitelistedValueIsAllowed()
/**
* @test
- * @expectedException \Neos\Eel\NotAllowedException
*/
public function firstLevelFunctionsHaveToBeWhitelisted()
{
+ $this->expectException(NotAllowedException::class);
$context = new ProtectedContext([
'ident' => function ($value) {
return $value;
@@ -109,10 +110,10 @@ public function firstLevelFunctionsHaveToBeWhitelisted()
/**
* @test
- * @expectedException \Neos\Eel\NotAllowedException
*/
public function resultOfFirstLevelMethodCallIsProtected()
{
+ $this->expectException(NotAllowedException::class);
$securedObject = new TestObject();
$context = new ProtectedContext([
@@ -133,10 +134,10 @@ public function resultOfFirstLevelMethodCallIsProtected()
/**
* @test
- * @expectedException \Neos\Eel\NotAllowedException
*/
public function resultOfWhitelistedMethodCallIsProtected()
{
+ $this->expectException(NotAllowedException::class);
$securedObject = new TestObject();
$context = new ProtectedContext([
diff --git a/Neos.Error.Messages/Tests/Unit/ResultTest.php b/Neos.Error.Messages/Tests/Unit/ResultTest.php
index 3c8e06999f..824db20f1e 100644
--- a/Neos.Error.Messages/Tests/Unit/ResultTest.php
+++ b/Neos.Error.Messages/Tests/Unit/ResultTest.php
@@ -24,7 +24,7 @@ class ResultTest extends \PHPUnit\Framework\TestCase
*/
protected $result;
- public function setUp()
+ protected function setUp(): void
{
$this->result = new Result();
}
diff --git a/Neos.Error.Messages/composer.json b/Neos.Error.Messages/composer.json
index 285fe3ae9e..7d6b9d7117 100644
--- a/Neos.Error.Messages/composer.json
+++ b/Neos.Error.Messages/composer.json
@@ -8,7 +8,7 @@
"php": "~7.1"
},
"require-dev": {
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Flow.Log/Tests/Unit/Backend/AbstractBackendTest.php b/Neos.Flow.Log/Tests/Unit/Backend/AbstractBackendTest.php
index 68c8af2448..1e34a23f6a 100644
--- a/Neos.Flow.Log/Tests/Unit/Backend/AbstractBackendTest.php
+++ b/Neos.Flow.Log/Tests/Unit/Backend/AbstractBackendTest.php
@@ -27,7 +27,7 @@ class AbstractBackendTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->backendClassName = 'ConcreteBackend_' . md5(uniqid(mt_rand(), true));
eval('
diff --git a/Neos.Flow.Log/Tests/Unit/Backend/FileBackendTest.php b/Neos.Flow.Log/Tests/Unit/Backend/FileBackendTest.php
index 2bc89c04b2..97ceaab29c 100644
--- a/Neos.Flow.Log/Tests/Unit/Backend/FileBackendTest.php
+++ b/Neos.Flow.Log/Tests/Unit/Backend/FileBackendTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Log\Exception\CouldNotOpenResourceException;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamWrapper;
use Neos\Flow\Log\Backend\FileBackend;
@@ -23,7 +24,7 @@ class FileBackendTest extends UnitTestCase
{
/**
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('testDirectory');
}
@@ -41,10 +42,10 @@ public function theLogFileIsOpenedWithOpen()
/**
* @test
- * @expectedException \Neos\Flow\Log\Exception\CouldNotOpenResourceException
*/
public function openDoesNotCreateParentDirectoriesByDefault()
{
+ $this->expectException(CouldNotOpenResourceException::class);
$logFileUrl = vfsStream::url('testDirectory') . '/foo/test.log';
$backend = new FileBackend(['logFileUrl' => $logFileUrl]);
$backend->open();
diff --git a/Neos.Flow.Log/Tests/Unit/Backend/JsonFileBackendTest.php b/Neos.Flow.Log/Tests/Unit/Backend/JsonFileBackendTest.php
index 42f390655a..23bdd222e4 100644
--- a/Neos.Flow.Log/Tests/Unit/Backend/JsonFileBackendTest.php
+++ b/Neos.Flow.Log/Tests/Unit/Backend/JsonFileBackendTest.php
@@ -23,7 +23,7 @@ class JsonFileBackendTest extends UnitTestCase
{
/**
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('testDirectory');
}
diff --git a/Neos.Flow.Log/Tests/Unit/LoggerTest.php b/Neos.Flow.Log/Tests/Unit/LoggerTest.php
index 7598aca9d4..4b5eb7b42f 100644
--- a/Neos.Flow.Log/Tests/Unit/LoggerTest.php
+++ b/Neos.Flow.Log/Tests/Unit/LoggerTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Log\Backend\BackendInterface;
use Neos\Flow\Log\DefaultLogger;
+use Neos\Flow\Log\Exception\NoSuchBackendException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -69,10 +70,10 @@ public function removeBackendRunsTheBackendsCloseMethodAndRemovesItFromTheLogger
/**
* @test
- * @expectedException \Neos\Flow\Log\Exception\NoSuchBackendException
*/
public function removeThrowsAnExceptionOnTryingToRemoveABackendNotPreviouslyAdded()
{
+ $this->expectException(NoSuchBackendException::class);
$mockBackend = $this->getMockBuilder(BackendInterface::class)->setMethods(['open', 'append', 'close'])->getMock();
$logger = new DefaultLogger();
diff --git a/Neos.Flow.Log/composer.json b/Neos.Flow.Log/composer.json
index cb7caf73fe..984c5746bd 100644
--- a/Neos.Flow.Log/composer.json
+++ b/Neos.Flow.Log/composer.json
@@ -12,7 +12,7 @@
"psr/log": "^1.0.1"
},
"require-dev": {
- "phpunit/phpunit": "~6.0.0"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Flow/Tests/Functional/Configuration/ConfigurationValidationTest.php b/Neos.Flow/Tests/Functional/Configuration/ConfigurationValidationTest.php
index 14d5138914..fbaff059ae 100644
--- a/Neos.Flow/Tests/Functional/Configuration/ConfigurationValidationTest.php
+++ b/Neos.Flow/Tests/Functional/Configuration/ConfigurationValidationTest.php
@@ -66,7 +66,7 @@ class ConfigurationValidationTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -112,7 +112,7 @@ public function setUp()
/**
* @return void
*/
- public function tearDown()
+ protected function tearDown(): void
{
$this->objectManager->setInstance(ConfigurationManager::class, $this->originalConfigurationManager);
$this->injectApplicationContextIntoConfigurationManager($this->objectManager->getContext());
diff --git a/Neos.Flow/Tests/Functional/Configuration/SchemaValidationTest.php b/Neos.Flow/Tests/Functional/Configuration/SchemaValidationTest.php
index 819363e42a..2ecfebb297 100644
--- a/Neos.Flow/Tests/Functional/Configuration/SchemaValidationTest.php
+++ b/Neos.Flow/Tests/Functional/Configuration/SchemaValidationTest.php
@@ -50,7 +50,7 @@ class SchemaValidationTest extends FunctionalTestCase
*/
protected $schemaValidator;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->schemaValidator = new SchemaValidator();
diff --git a/Neos.Flow/Tests/Functional/Error/DebuggerTest.php b/Neos.Flow/Tests/Functional/Error/DebuggerTest.php
index 78c9123896..125b2e4b7d 100644
--- a/Neos.Flow/Tests/Functional/Error/DebuggerTest.php
+++ b/Neos.Flow/Tests/Functional/Error/DebuggerTest.php
@@ -29,7 +29,7 @@ class DebuggerTest extends FunctionalTestCase
protected $configurationManager;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->configurationManager = $this->objectManager->get(ConfigurationManager::class);
@@ -51,6 +51,6 @@ public function ignoredClassesCanBeOverwrittenBySettings()
$newConfiguration = Arrays::arrayMergeRecursiveOverrule($currentConfiguration, $configurationOverwrite);
ObjectAccess::setProperty($this->configurationManager, 'configurations', $newConfiguration, true);
- $this->assertContains('rootContextString', Debugger::renderDump($object, 0, true));
+ $this->assertStringContainsString('rootContextString', Debugger::renderDump($object, 0, true));
}
}
diff --git a/Neos.Flow/Tests/Functional/Http/Client/BrowserTest.php b/Neos.Flow/Tests/Functional/Http/Client/BrowserTest.php
index eb2ad28925..239704da4d 100644
--- a/Neos.Flow/Tests/Functional/Http/Client/BrowserTest.php
+++ b/Neos.Flow/Tests/Functional/Http/Client/BrowserTest.php
@@ -26,7 +26,7 @@ class BrowserTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->registerRoute(
@@ -62,7 +62,7 @@ public function redirectsAreNotFollowedIfSwitchedOff()
{
$this->browser->setFollowRedirects(false);
$response = $this->browser->request('http://localhost/test/http/redirecting');
- $this->assertNotContains('arrived.', $response->getContent());
+ $this->assertStringNotContainsString('arrived.', $response->getContent());
$this->assertEquals(303, $response->getStatusCode());
$this->assertEquals('http://localhost/test/http/redirecting/tohere', $response->getHeader('Location'));
}
diff --git a/Neos.Flow/Tests/Functional/Http/Client/CurlEngineTest.php b/Neos.Flow/Tests/Functional/Http/Client/CurlEngineTest.php
index a6b41f98a9..0143cae41e 100644
--- a/Neos.Flow/Tests/Functional/Http/Client/CurlEngineTest.php
+++ b/Neos.Flow/Tests/Functional/Http/Client/CurlEngineTest.php
@@ -29,7 +29,7 @@ class CurlEngineTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$curlEngine = $this->objectManager->get(CurlEngine::class);
@@ -57,6 +57,6 @@ public function redirectsAreFollowed()
public function getRequestReturnsResponse()
{
$response = $this->browser->request('http://www.neos.io');
- $this->assertContains('This website is powered by Neos', $response->getContent());
+ $this->assertStringContainsString('This website is powered by Neos', $response->getContent());
}
}
diff --git a/Neos.Flow/Tests/Functional/Http/Client/InternalRequestEngineTest.php b/Neos.Flow/Tests/Functional/Http/Client/InternalRequestEngineTest.php
index e31fd64e6f..3618df9a41 100644
--- a/Neos.Flow/Tests/Functional/Http/Client/InternalRequestEngineTest.php
+++ b/Neos.Flow/Tests/Functional/Http/Client/InternalRequestEngineTest.php
@@ -27,7 +27,7 @@ class InternalRequestEngineTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/I18n/Cldr/CldrRepositoryTest.php b/Neos.Flow/Tests/Functional/I18n/Cldr/CldrRepositoryTest.php
index 0b8455e010..d3eaffb36d 100644
--- a/Neos.Flow/Tests/Functional/I18n/Cldr/CldrRepositoryTest.php
+++ b/Neos.Flow/Tests/Functional/I18n/Cldr/CldrRepositoryTest.php
@@ -35,7 +35,7 @@ class CldrRepositoryTest extends FunctionalTestCase
/**
* Initialize dependencies
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->cldrRepository = $this->objectManager->get(CldrRepository::class);
diff --git a/Neos.Flow/Tests/Functional/I18n/FormatResolverTest.php b/Neos.Flow/Tests/Functional/I18n/FormatResolverTest.php
index ff5cf0091e..6525287140 100644
--- a/Neos.Flow/Tests/Functional/I18n/FormatResolverTest.php
+++ b/Neos.Flow/Tests/Functional/I18n/FormatResolverTest.php
@@ -29,7 +29,7 @@ class FormatResolverTest extends FunctionalTestCase
/**
* Initialize dependencies
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->formatResolver = $this->objectManager->get(FormatResolver::class);
diff --git a/Neos.Flow/Tests/Functional/I18n/TranslatorTest.php b/Neos.Flow/Tests/Functional/I18n/TranslatorTest.php
index 26e1f4782c..45f4596c2d 100644
--- a/Neos.Flow/Tests/Functional/I18n/TranslatorTest.php
+++ b/Neos.Flow/Tests/Functional/I18n/TranslatorTest.php
@@ -28,7 +28,7 @@ class TranslatorTest extends FunctionalTestCase
/**
* Initialize dependencies
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->translator = $this->objectManager->get(I18n\Translator::class);
diff --git a/Neos.Flow/Tests/Functional/I18n/Xliff/Service/XliffFileProviderTest.php b/Neos.Flow/Tests/Functional/I18n/Xliff/Service/XliffFileProviderTest.php
index 3e65610296..e012046f21 100644
--- a/Neos.Flow/Tests/Functional/I18n/Xliff/Service/XliffFileProviderTest.php
+++ b/Neos.Flow/Tests/Functional/I18n/Xliff/Service/XliffFileProviderTest.php
@@ -34,7 +34,7 @@ class XliffFileProviderTest extends FunctionalTestCase
/**
* Initialize dependencies
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$cacheManager = $this->objectManager->get(CacheManager::class);
diff --git a/Neos.Flow/Tests/Functional/Mvc/AbstractControllerTest.php b/Neos.Flow/Tests/Functional/Mvc/AbstractControllerTest.php
index dc90b5df4a..05bccd17bb 100644
--- a/Neos.Flow/Tests/Functional/Mvc/AbstractControllerTest.php
+++ b/Neos.Flow/Tests/Functional/Mvc/AbstractControllerTest.php
@@ -24,7 +24,7 @@ class AbstractControllerTest extends FunctionalTestCase
/**
* Additional setup: Routes
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Mvc/ActionControllerTest.php b/Neos.Flow/Tests/Functional/Mvc/ActionControllerTest.php
index c047fe8f62..4a06093429 100644
--- a/Neos.Flow/Tests/Functional/Mvc/ActionControllerTest.php
+++ b/Neos.Flow/Tests/Functional/Mvc/ActionControllerTest.php
@@ -27,7 +27,7 @@ class ActionControllerTest extends FunctionalTestCase
/**
* Additional setup: Routes
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Mvc/RoutingTest.php b/Neos.Flow/Tests/Functional/Mvc/RoutingTest.php
index 9653e62b4f..833ce75971 100644
--- a/Neos.Flow/Tests/Functional/Mvc/RoutingTest.php
+++ b/Neos.Flow/Tests/Functional/Mvc/RoutingTest.php
@@ -35,7 +35,7 @@ class RoutingTest extends FunctionalTestCase
/**
* Validate that test routes are loaded
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Mvc/ViewsConfiguration/ViewsConfigurationTest.php b/Neos.Flow/Tests/Functional/Mvc/ViewsConfiguration/ViewsConfigurationTest.php
index 947e92adf4..d50a8b9da0 100644
--- a/Neos.Flow/Tests/Functional/Mvc/ViewsConfiguration/ViewsConfigurationTest.php
+++ b/Neos.Flow/Tests/Functional/Mvc/ViewsConfiguration/ViewsConfigurationTest.php
@@ -32,7 +32,7 @@ class ViewsConfigurationTest extends FunctionalTestCase
/**
* Additional setup: Routes
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/ObjectManagement/DependencyInjectionTest.php b/Neos.Flow/Tests/Functional/ObjectManagement/DependencyInjectionTest.php
index dd3fb0e897..185063b520 100644
--- a/Neos.Flow/Tests/Functional/ObjectManagement/DependencyInjectionTest.php
+++ b/Neos.Flow/Tests/Functional/ObjectManagement/DependencyInjectionTest.php
@@ -28,7 +28,7 @@ class DependencyInjectionTest extends FunctionalTestCase
*/
protected $configurationManager;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Persistence/Aspect/PersistenceMagicAspectTest.php b/Neos.Flow/Tests/Functional/Persistence/Aspect/PersistenceMagicAspectTest.php
index 53a022c623..b7d3d2fbcc 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Aspect/PersistenceMagicAspectTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Aspect/PersistenceMagicAspectTest.php
@@ -28,7 +28,7 @@ class PersistenceMagicAspectTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/AggregateTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/AggregateTest.php
index 8b82b13b19..4042963909 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/AggregateTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/AggregateTest.php
@@ -38,7 +38,7 @@ class AggregateTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/IndexedCollectionTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/IndexedCollectionTest.php
index 9e499ae2b5..452d8ed25b 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/IndexedCollectionTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/IndexedCollectionTest.php
@@ -27,7 +27,7 @@ class IndexedCollectionTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/LazyLoadingTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/LazyLoadingTest.php
index 6462bfb94f..53c2553b6a 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/LazyLoadingTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/LazyLoadingTest.php
@@ -38,7 +38,7 @@ class LazyLoadingTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriverTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriverTest.php
index 2b2b35a437..c14af0677d 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriverTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriverTest.php
@@ -30,7 +30,7 @@ class FlowAnnotationDriverTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/PersistClonedRelatedEntitiesTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/PersistClonedRelatedEntitiesTest.php
index 256d39781c..230e1ec0f5 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/PersistClonedRelatedEntitiesTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/PersistClonedRelatedEntitiesTest.php
@@ -33,7 +33,7 @@ class PersistClonedRelatedEntitiesTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/QueryTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/QueryTest.php
index 1e97f5eb4f..e22ba48b58 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/QueryTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/QueryTest.php
@@ -30,7 +30,7 @@ class QueryTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Persistence/Doctrine/RepositoryTest.php b/Neos.Flow/Tests/Functional/Persistence/Doctrine/RepositoryTest.php
index 582192fa9f..95ccc12c43 100644
--- a/Neos.Flow/Tests/Functional/Persistence/Doctrine/RepositoryTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/Doctrine/RepositoryTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Persistence\Doctrine\PersistenceManager;
use Neos\Flow\Persistence\Doctrine\Repository;
+use Neos\Flow\Persistence\Exception\IllegalObjectTypeException;
use Neos\Flow\Persistence\QueryResultInterface;
use Neos\Flow\Tests\Functional\Persistence\Fixtures;
use Neos\Flow\Tests\FunctionalTestCase;
@@ -45,7 +46,7 @@ class RepositoryTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
@@ -274,10 +275,10 @@ public function findByIdentifierReturnsSubTypesOfTheManagedType()
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\IllegalObjectTypeException
*/
public function addingASuperTypeToAMoreSpecificRepositoryThrowsAnException()
{
+ $this->expectException(IllegalObjectTypeException::class);
$this->subSubEntityRepository = $this->objectManager->get(Fixtures\SubSubEntityRepository::class);
$subEntity = new Fixtures\SubEntity();
diff --git a/Neos.Flow/Tests/Functional/Persistence/PersistenceTest.php b/Neos.Flow/Tests/Functional/Persistence/PersistenceTest.php
index 59b9e627b9..3d88d9278c 100644
--- a/Neos.Flow/Tests/Functional/Persistence/PersistenceTest.php
+++ b/Neos.Flow/Tests/Functional/Persistence/PersistenceTest.php
@@ -16,6 +16,8 @@
use Neos\Flow\Configuration\ConfigurationManager;
use Neos\Flow\Persistence\Doctrine\PersistenceManager;
use Neos\Flow\Persistence\Doctrine\QueryResult;
+use Neos\Flow\Persistence\Exception;
+use Neos\Flow\Persistence\Exception\ObjectValidationFailedException;
use Neos\Flow\Tests\FunctionalTestCase;
/**
@@ -42,7 +44,7 @@ class PersistenceTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
@@ -77,7 +79,7 @@ public function executingAQueryWillOnlyExecuteItLazily()
$this->assertAttributeInternalType('null', 'rows', $allResults, 'Query Result did not load the result collection lazily.');
$allResultsArray = $allResults->toArray();
- $this->assertEquals('Flow', $allResultsArray[0]->getName());
+ $this->assertStringContainsString('Flow', $allResultsArray[0]->getName());
$this->assertAttributeInternalType('array', 'rows', $allResults);
}
@@ -275,10 +277,10 @@ public function embeddedValueObjectsAreActuallyEmbedded()
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\ObjectValidationFailedException
*/
public function validationIsDoneForNewEntities()
{
+ $this->expectException(ObjectValidationFailedException::class);
$this->removeExampleEntities();
$this->insertExampleEntity('A');
@@ -287,10 +289,10 @@ public function validationIsDoneForNewEntities()
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\ObjectValidationFailedException
*/
public function validationIsDoneForReconstitutedEntities()
{
+ $this->expectException(ObjectValidationFailedException::class);
$this->removeExampleEntities();
$this->insertExampleEntity();
$this->persistenceManager->persistAll();
@@ -305,10 +307,10 @@ public function validationIsDoneForReconstitutedEntities()
* Testcase for issue #32830 - Validation on persist breaks with Doctrine Lazy Loading Proxies
*
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\ObjectValidationFailedException
*/
public function validationIsDoneForReconstitutedEntitiesWhichAreLazyLoadingProxies()
{
+ $this->expectException(ObjectValidationFailedException::class);
$this->removeExampleEntities();
$this->insertExampleEntity();
$this->persistenceManager->persistAll();
@@ -373,11 +375,11 @@ public function eventListenersAreProperlyExecuted()
}
/**
- * @expectedException \Neos\Flow\Persistence\Exception
* @test
*/
public function persistAllThrowsExceptionIfNonWhitelistedObjectsAreDirtyAndFlagIsSet()
{
+ $this->expectException(Exception::class);
$testEntity = new Fixtures\TestEntity();
$testEntity->setName('Surfer girl');
$this->testEntityRepository->add($testEntity);
@@ -385,11 +387,11 @@ public function persistAllThrowsExceptionIfNonWhitelistedObjectsAreDirtyAndFlagI
}
/**
- * @expectedException \Neos\Flow\Persistence\Exception
* @test
*/
public function persistAllThrowsExceptionIfNonWhitelistedObjectsAreUpdatedAndFlagIsSet()
{
+ $this->expectException(Exception::class);
$this->removeExampleEntities();
$this->insertExampleEntity();
$this->persistenceManager->persistAll();
diff --git a/Neos.Flow/Tests/Functional/Property/PropertyMapperTest.php b/Neos.Flow/Tests/Functional/Property/PropertyMapperTest.php
index 01bcbe806b..0a45239990 100644
--- a/Neos.Flow/Tests/Functional/Property/PropertyMapperTest.php
+++ b/Neos.Flow/Tests/Functional/Property/PropertyMapperTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Property\Exception;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\Property\PropertyMappingConfiguration;
use Neos\Flow\Property\PropertyMappingConfigurationInterface;
@@ -35,7 +36,7 @@ class PropertyMapperTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->propertyMapper = $this->objectManager->get(PropertyMapper::class);
@@ -159,10 +160,10 @@ public function targetTypeForEntityCanBeOverriddenIfConfigured()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception
*/
public function overriddenTargetTypeForEntityMustBeASubclass()
{
+ $this->expectException(Exception::class);
$source = [
'__type' => Fixtures\TestClass::class,
'name' => 'A horse'
@@ -193,10 +194,10 @@ public function targetTypeForSimpleObjectCanBeOverriddenIfConfigured()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception
*/
public function overriddenTargetTypeForSimpleObjectMustBeASubclass()
{
+ $this->expectException(Exception::class);
$source = [
'__type' => Fixtures\TestEntity::class,
'name' => 'A horse'
@@ -350,10 +351,10 @@ public function mappingToFieldsFromSubclassWorksIfTargetTypeIsOverridden()
/**
* @test
* @dataProvider invalidTypeConverterConfigurationsForOverridingTargetTypes
- * @expectedException \Neos\Flow\Property\Exception
*/
public function mappingToFieldsFromSubclassThrowsExceptionIfTypeConverterOptionIsInvalidOrNotSet(PropertyMappingConfigurationInterface $configuration = null)
{
+ $this->expectException(Exception::class);
$source = [
'__type' => Fixtures\TestEntitySubclassWithNewField::class,
'testField' => 'A horse'
@@ -383,10 +384,10 @@ public function invalidTypeConverterConfigurationsForOverridingTargetTypes()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception
*/
public function convertFromShouldThrowExceptionIfGivenSourceTypeIsNotATargetType()
{
+ $this->expectException(Exception::class);
$source = [
'__type' => Fixtures\TestClass::class,
'testField' => 'A horse'
diff --git a/Neos.Flow/Tests/Functional/Property/TypeConverter/FloatConverterTest.php b/Neos.Flow/Tests/Functional/Property/TypeConverter/FloatConverterTest.php
index 8f0173dc46..d807baf5ab 100644
--- a/Neos.Flow/Tests/Functional/Property/TypeConverter/FloatConverterTest.php
+++ b/Neos.Flow/Tests/Functional/Property/TypeConverter/FloatConverterTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException;
use Neos\Flow\I18n\Locale;
use Neos\Flow\Property\PropertyMappingConfiguration;
use Neos\Flow\Property\TypeConverter\FloatConverter;
@@ -28,7 +29,7 @@ class FloatConverterTest extends FunctionalTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->converter = $this->objectManager->get(\Neos\Flow\Property\TypeConverter\FloatConverter::class);
@@ -83,10 +84,10 @@ public function convertFromReturnsErrorIfFormatIsInvalid()
/**
* @test
- * @expectedException \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException
*/
public function convertFromThrowsExceptionIfLocaleIsInvalid()
{
+ $this->expectException(InvalidLocaleIdentifierException::class);
$configuration = new PropertyMappingConfiguration();
$configuration->setTypeConverterOption(FloatConverter::class, 'locale', 'some-non-existent-locale-identifier');
diff --git a/Neos.Flow/Tests/Functional/Property/TypeConverter/ObjectConverterTest.php b/Neos.Flow/Tests/Functional/Property/TypeConverter/ObjectConverterTest.php
index 4c3116d78c..747af96bed 100644
--- a/Neos.Flow/Tests/Functional/Property/TypeConverter/ObjectConverterTest.php
+++ b/Neos.Flow/Tests/Functional/Property/TypeConverter/ObjectConverterTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Property\Exception\InvalidTargetException;
use Neos\Flow\Property\PropertyMappingConfiguration;
use Neos\Flow\Property\TypeConverter\ObjectConverter;
use Neos\Utility\ObjectAccess;
@@ -26,7 +27,7 @@ class ObjectConverterTest extends FunctionalTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->converter = $this->objectManager->get(ObjectConverter::class);
@@ -79,11 +80,11 @@ public function getTypeOfChildPropertyReturnsCorrectTypeIfASetterForThatProperty
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidTargetException
- * @expectedExceptionCode 1406821818
*/
public function getTypeOfChildPropertyThrowsExceptionIfThatPropertyIsPubliclyPresentButHasNoProperTypeAnnotation()
{
+ $this->expectExceptionCode(1406821818);
+ $this->expectException(InvalidTargetException::class);
$this->converter->getTypeOfChildProperty(
Fixtures\TestClass::class,
'somePublicPropertyWithoutVarAnnotation',
@@ -172,10 +173,10 @@ public function convertFromAllowsAutomaticInjectionOfSingletonConstructorArgumen
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidTargetException
*/
public function convertFromThrowsMeaningfulExceptionWhenTheTargetExpectsAnUnknownDependencyThatIsNotSpecifiedInTheSource()
{
+ $this->expectException(InvalidTargetException::class);
$this->converter->convertFrom(
'irrelevant',
\Neos\Flow\Tests\Functional\Property\Fixtures\TestClassWithThirdPartyClassConstructorInjection::class
diff --git a/Neos.Flow/Tests/Functional/Property/TypeConverter/PersistentObjectConverterTest.php b/Neos.Flow/Tests/Functional/Property/TypeConverter/PersistentObjectConverterTest.php
index ca392497ba..d4dda8d9f2 100644
--- a/Neos.Flow/Tests/Functional/Property/TypeConverter/PersistentObjectConverterTest.php
+++ b/Neos.Flow/Tests/Functional/Property/TypeConverter/PersistentObjectConverterTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Property\Exception;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\Tests\FunctionalTestCase;
use Neos\Flow\Tests\Functional\Property\Fixtures;
@@ -34,7 +35,7 @@ class PersistentObjectConverterTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->propertyMapper = $this->objectManager->get(PropertyMapper::class);
@@ -97,10 +98,10 @@ public function entityWithImmutablePropertyCanBeUpdatedIfImmutablePropertyIsGive
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception
*/
public function entityWithImmutablePropertyCanNotBeUpdatedWhenImmutablePropertyChanged()
{
+ $this->expectException(Exception::class);
$result = $this->propertyMapper->convert($this->sourceProperties, Fixtures\TestEntityWithImmutableProperty::class);
$identifier = $this->persistenceManager->getIdentifierByObject($result);
$this->persistenceManager->add($result);
diff --git a/Neos.Flow/Tests/Functional/Reflection/ReflectionServiceTest.php b/Neos.Flow/Tests/Functional/Reflection/ReflectionServiceTest.php
index 42bf23823a..5f9a3b07a4 100644
--- a/Neos.Flow/Tests/Functional/Reflection/ReflectionServiceTest.php
+++ b/Neos.Flow/Tests/Functional/Reflection/ReflectionServiceTest.php
@@ -26,7 +26,7 @@ class ReflectionServiceTest extends FunctionalTestCase
*/
protected $reflectionService;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->reflectionService = $this->objectManager->get(ReflectionService::class);
diff --git a/Neos.Flow/Tests/Functional/ResourceManagement/PersistentResourceTest.php b/Neos.Flow/Tests/Functional/ResourceManagement/PersistentResourceTest.php
index f3e565f137..309b5a0090 100644
--- a/Neos.Flow/Tests/Functional/ResourceManagement/PersistentResourceTest.php
+++ b/Neos.Flow/Tests/Functional/ResourceManagement/PersistentResourceTest.php
@@ -33,7 +33,7 @@ class PersistentResourceTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/ResourceManagement/ResourceManagerTest.php b/Neos.Flow/Tests/Functional/ResourceManagement/ResourceManagerTest.php
index f838aa10ba..ae4cd6cf8d 100644
--- a/Neos.Flow/Tests/Functional/ResourceManagement/ResourceManagerTest.php
+++ b/Neos.Flow/Tests/Functional/ResourceManagement/ResourceManagerTest.php
@@ -39,7 +39,7 @@ class ResourceManagerTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Security/AccountTest.php b/Neos.Flow/Tests/Functional/Security/AccountTest.php
index 4b4bf13b5e..20e55d567d 100644
--- a/Neos.Flow/Tests/Functional/Security/AccountTest.php
+++ b/Neos.Flow/Tests/Functional/Security/AccountTest.php
@@ -31,7 +31,7 @@ class AccountTest extends FunctionalTestCase
*/
protected $account;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php b/Neos.Flow/Tests/Functional/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php
index 65d5c2e4a6..a6881b77db 100644
--- a/Neos.Flow/Tests/Functional/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php
+++ b/Neos.Flow/Tests/Functional/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php
@@ -45,7 +45,7 @@ class PersistedUsernamePasswordProviderTest extends FunctionalTestCase
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Security/AuthenticationTest.php b/Neos.Flow/Tests/Functional/Security/AuthenticationTest.php
index 42a528e14d..22909f7ae0 100644
--- a/Neos.Flow/Tests/Functional/Security/AuthenticationTest.php
+++ b/Neos.Flow/Tests/Functional/Security/AuthenticationTest.php
@@ -36,7 +36,7 @@ class AuthenticationTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -163,7 +163,7 @@ public function successfulAuthenticationCallsOnAuthenticationSuccessMethod()
public function failedAuthenticationCallsOnAuthenticationFailureMethod()
{
$response = $this->browser->request('http://localhost/test/security/authentication');
- $this->assertContains('Uncaught Exception in Flow #42: Failure Method Exception', $response->getContent());
+ $this->assertStringContainsString('Uncaught Exception in Flow #42: Failure Method Exception', $response->getContent());
}
/**
diff --git a/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/ContentSecurityTest.php b/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/ContentSecurityTest.php
index a89008c5b8..29d0e40911 100644
--- a/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/ContentSecurityTest.php
+++ b/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/ContentSecurityTest.php
@@ -63,7 +63,7 @@ class ContentSecurityTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/EntityPrivilegeExpressionEvaluatorTest.php b/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/EntityPrivilegeExpressionEvaluatorTest.php
index e173c71038..9dde99cd61 100644
--- a/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/EntityPrivilegeExpressionEvaluatorTest.php
+++ b/Neos.Flow/Tests/Functional/Security/Authorization/Privilege/Entity/Doctrine/EntityPrivilegeExpressionEvaluatorTest.php
@@ -31,7 +31,7 @@ class EntityPrivilegeExpressionEvaluatorTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Security/CsrfProtectionTest.php b/Neos.Flow/Tests/Functional/Security/CsrfProtectionTest.php
index e25dc0fdb8..0b4ae8aa5d 100644
--- a/Neos.Flow/Tests/Functional/Security/CsrfProtectionTest.php
+++ b/Neos.Flow/Tests/Functional/Security/CsrfProtectionTest.php
@@ -37,7 +37,7 @@ class CsrfProtectionTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Functional/Session/SessionManagementTest.php b/Neos.Flow/Tests/Functional/Session/SessionManagementTest.php
index 6211834c27..13c0ee9e99 100644
--- a/Neos.Flow/Tests/Functional/Session/SessionManagementTest.php
+++ b/Neos.Flow/Tests/Functional/Session/SessionManagementTest.php
@@ -20,7 +20,7 @@ class SessionManagementTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -101,10 +101,10 @@ public function aSessionUsedInAFunctionalTestVirtualBrowserSendsCookiesOnEachReq
{
$response = $this->browser->request('http://localhost/test/session');
$this->assertTrue($response->hasHeader('Set-Cookie'), 'Available Cookies are: ' . implode(', ', array_keys($response->getHeader('Set-Cookie'))));
- $this->assertContains('Flow_Testing_Session', implode(',', $response->getHeader('Set-Cookie')));
+ $this->assertStringContainsString('Flow_Testing_Session', implode(',', $response->getHeader('Set-Cookie')));
$response = $this->browser->request('http://localhost/test/session');
$this->assertTrue($response->hasHeader('Set-Cookie'), 'Available Cookies are: ' . implode(', ', array_keys($response->getHeader('Set-Cookie'))));
- $this->assertContains('Flow_Testing_Session', implode(',', $response->getHeader('Set-Cookie')));
+ $this->assertStringContainsString('Flow_Testing_Session', implode(',', $response->getHeader('Set-Cookie')));
}
}
diff --git a/Neos.Flow/Tests/Functional/Validation/ValidationTest.php b/Neos.Flow/Tests/Functional/Validation/ValidationTest.php
index 564d4b4ec4..88c617d79f 100644
--- a/Neos.Flow/Tests/Functional/Validation/ValidationTest.php
+++ b/Neos.Flow/Tests/Functional/Validation/ValidationTest.php
@@ -36,7 +36,7 @@ class ValidationTest extends FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof PersistenceManager) {
diff --git a/Neos.Flow/Tests/Functional/Validation/Validator/UniqueEntityValidatorTest.php b/Neos.Flow/Tests/Functional/Validation/Validator/UniqueEntityValidatorTest.php
index eba444c283..12bb6f76c8 100644
--- a/Neos.Flow/Tests/Functional/Validation/Validator/UniqueEntityValidatorTest.php
+++ b/Neos.Flow/Tests/Functional/Validation/Validator/UniqueEntityValidatorTest.php
@@ -33,7 +33,7 @@ class UniqueEntityValidatorTest extends \Neos\Flow\Tests\FunctionalTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
if (!$this->persistenceManager instanceof \Neos\Flow\Persistence\Doctrine\PersistenceManager) {
diff --git a/Neos.Flow/Tests/FunctionalTestCase.php b/Neos.Flow/Tests/FunctionalTestCase.php
index 9736bd0e0b..bd35f70f49 100644
--- a/Neos.Flow/Tests/FunctionalTestCase.php
+++ b/Neos.Flow/Tests/FunctionalTestCase.php
@@ -119,7 +119,7 @@ abstract class FunctionalTestCase extends \Neos\Flow\Tests\BaseTestCase
*
* @return void
*/
- public static function setUpBeforeClass()
+ public static function setUpBeforeClass(): void
{
self::$bootstrap = \Neos\Flow\Core\Bootstrap::$staticObjectManager->get(\Neos\Flow\Core\Bootstrap::class);
self::setupSuperGlobals();
@@ -133,7 +133,7 @@ public static function setUpBeforeClass()
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->objectManager = self::$bootstrap->getObjectManager();
@@ -234,7 +234,7 @@ protected function route(Request $httpRequest)
*
* @return void
*/
- public function tearDown()
+ protected function tearDown(): void
{
$this->tearDownSecurity();
diff --git a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutExpressionParserTest.php b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutExpressionParserTest.php
index 852943a486..774b008dc6 100644
--- a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutExpressionParserTest.php
+++ b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutExpressionParserTest.php
@@ -42,7 +42,7 @@ class PointcutExpressionParserTest extends UnitTestCase
*
* @return void
*/
- public function setup()
+ protected function setUp(): void
{
$this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$this->mockReflectionService = $this->getMockBuilder(ReflectionService::class)->disableOriginalConstructor()->getMock();
@@ -50,20 +50,20 @@ public function setup()
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function parseThrowsExceptionIfPointcutExpressionIsNotAString()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$parser = new PointcutExpressionParser();
$parser->parse(false, 'Unit Test');
}
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function parseThrowsExceptionIfThePointcutExpressionContainsNoDesignator()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$parser = new PointcutExpressionParser();
$parser->injectObjectManager($this->mockObjectManager);
$parser->parse('()', 'Unit Test');
@@ -184,10 +184,10 @@ public function parseDesignatorMethodAnnotatedWithAddsAFilterToTheGivenFilterCom
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function parseDesignatorMethodThrowsAnExceptionIfTheExpressionLacksTheClassMethodArrow()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$mockComposite = $this->getMockBuilder(PointcutFilterComposite::class)->disableOriginalConstructor()->getMock();
$parser = $this->getAccessibleMock(PointcutExpressionParser::class, ['dummy'], [], '', false);
$parser->_call('parseDesignatorMethod', '&&', 'Foo bar', $mockComposite);
@@ -272,10 +272,10 @@ public function getArgumentConstraintsFromMethodArgumentsPatternWorks()
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function parseDesignatorPointcutThrowsAnExceptionIfTheExpressionLacksTheAspectClassMethodArrow()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$mockComposite = $this->getMockBuilder(PointcutFilterComposite::class)->disableOriginalConstructor()->getMock();
$parser = $this->getAccessibleMock(PointcutExpressionParser::class, ['dummy'], [], '', false);
$parser->_call('parseDesignatorPointcut', '&&', '\Foo\Bar', $mockComposite);
@@ -300,10 +300,10 @@ public function parseDesignatorFilterAddsACustomFilterToTheGivenFilterComposite(
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function parseDesignatorFilterThrowsAnExceptionIfACustomFilterDoesNotImplementThePointcutFilterInterface()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$mockFilter = new \ArrayObject();
$mockPointcutFilterComposite = $this->getMockBuilder(PointcutFilterComposite::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutFilterTest.php b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutFilterTest.php
index 4b377afd6c..a284f58bba 100644
--- a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutFilterTest.php
+++ b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutFilterTest.php
@@ -21,10 +21,10 @@ class PointcutFilterTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\UnknownPointcutException
*/
public function matchesThrowsAnExceptionIfTheSpecifiedPointcutDoesNotExist()
{
+ $this->expectException(Aop\Exception\UnknownPointcutException::class);
$className = 'Foo';
$methodName = 'bar';
$methodDeclaringClassName = 'Baz';
diff --git a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutSettingFilterTest.php b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutSettingFilterTest.php
index 9cde241992..0cf70a99c7 100644
--- a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutSettingFilterTest.php
+++ b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutSettingFilterTest.php
@@ -52,10 +52,10 @@ public function filterMatchesOnConfigurationSettingSetToFalse()
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function filterThrowsAnExceptionForNotExistingConfigurationSetting()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock();
$settings['foo']['bar']['baz']['value'] = true;
@@ -142,10 +142,11 @@ public function filterDoesNotMatchOnAFalseCondition()
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
+ *
*/
public function filterThrowsAnExceptionForAnIncorectCondition()
{
+ $this->expectException(Aop\Exception\InvalidPointcutExpressionException::class);
$mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock();
$settings['foo']['bar']['baz']['value'] = 'option value';
diff --git a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutTest.php b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutTest.php
index 996fa88536..07764ffde8 100644
--- a/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutTest.php
+++ b/Neos.Flow/Tests/Unit/Aop/Pointcut/PointcutTest.php
@@ -39,10 +39,10 @@ public function matchesChecksIfTheGivenClassAndMethodMatchThePointcutFilterCompo
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\CircularPointcutReferenceException
*/
public function matchesDetectsCircularMatchesAndThrowsAndException()
{
+ $this->expectException(Aop\Exception\CircularPointcutReferenceException::class);
$pointcutExpression = 'ThePointcutExpression';
$aspectClassName = 'TheAspect';
$className = 'TheClass';
diff --git a/Neos.Flow/Tests/Unit/Cache/CacheFactoryTest.php b/Neos.Flow/Tests/Unit/Cache/CacheFactoryTest.php
index 3f4f1574f4..6914a24259 100644
--- a/Neos.Flow/Tests/Unit/Cache/CacheFactoryTest.php
+++ b/Neos.Flow/Tests/Unit/Cache/CacheFactoryTest.php
@@ -45,7 +45,7 @@ class CacheFactoryTest extends UnitTestCase
/**
* Creates the mocked filesystem used in the tests
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
diff --git a/Neos.Flow/Tests/Unit/Cache/CacheManagerTest.php b/Neos.Flow/Tests/Unit/Cache/CacheManagerTest.php
index 0fd0b70fad..9e92a14041 100644
--- a/Neos.Flow/Tests/Unit/Cache/CacheManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Cache/CacheManagerTest.php
@@ -45,7 +45,7 @@ class CacheManagerTest extends UnitTestCase
*/
protected $mockEnvironment;
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
$this->cacheManager = new CacheManager();
@@ -77,10 +77,10 @@ protected function registerCache($cacheIdentifier)
/**
* @test
- * @expectedException \Neos\Cache\Exception\DuplicateIdentifierException
*/
public function managerThrowsExceptionOnCacheRegistrationWithAlreadyExistingIdentifier()
{
+ $this->expectException(Cache\Exception\DuplicateIdentifierException::class);
$cache1 = $this->getMockBuilder(Cache\Frontend\AbstractFrontend::class)->disableOriginalConstructor()->getMock();
$cache1->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('test'));
@@ -110,10 +110,10 @@ public function managerReturnsThePreviouslyRegisteredCached()
/**
* @test
- * @expectedException \Neos\Cache\Exception\NoSuchCacheException
*/
public function getCacheThrowsExceptionForNonExistingIdentifier()
{
+ $this->expectException(Cache\Exception\NoSuchCacheException::class);
$cache = $this->getMockBuilder(Cache\Frontend\AbstractFrontend::class)->disableOriginalConstructor()->getMock();
$cache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('someidentifier'));
diff --git a/Neos.Flow/Tests/Unit/Cli/CommandManagerTest.php b/Neos.Flow/Tests/Unit/Cli/CommandManagerTest.php
index 50e0bc160b..05798cf556 100644
--- a/Neos.Flow/Tests/Unit/Cli/CommandManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Cli/CommandManagerTest.php
@@ -14,6 +14,8 @@
use Neos\Flow\Cli\CommandManager;
use Neos\Flow\Cli;
use Neos\Flow\Core\Bootstrap;
+use Neos\Flow\Mvc\Exception\AmbiguousCommandIdentifierException;
+use Neos\Flow\Mvc\Exception\NoSuchCommandException;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\Tests\UnitTestCase;
@@ -40,7 +42,7 @@ class CommandManagerTest extends UnitTestCase
*/
protected $commandManager;
- public function setUp()
+ protected function setUp(): void
{
$this->mockReflectionService = $this->createMock(ReflectionService::class);
$this->commandManager = $this->getMockBuilder(Cli\CommandManager::class)->setMethods(['getAvailableCommands'])->getMock();
@@ -110,10 +112,10 @@ public function getCommandByIdentifierAllowsThePackageKeyToOnlyContainTheLastPar
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\NoSuchCommandException
*/
public function getCommandByIdentifierThrowsExceptionIfNoMatchingCommandWasFound()
{
+ $this->expectException(NoSuchCommandException::class);
$mockCommand = $this->getMockBuilder(Cli\Command::class)->disableOriginalConstructor()->getMock();
$mockCommand->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('package.key:controller:command'));
$mockCommands = [$mockCommand];
@@ -124,10 +126,10 @@ public function getCommandByIdentifierThrowsExceptionIfNoMatchingCommandWasFound
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\AmbiguousCommandIdentifierException
*/
public function getCommandByIdentifierThrowsExceptionIfMoreThanOneMatchingCommandWasFound()
{
+ $this->expectException(AmbiguousCommandIdentifierException::class);
$mockCommand1 = $this->getMockBuilder(Cli\Command::class)->disableOriginalConstructor()->getMock();
$mockCommand1->expects($this->once())->method('getCommandIdentifier')->will($this->returnValue('package.key:controller:command'));
$mockCommand2 = $this->getMockBuilder(Cli\Command::class)->disableOriginalConstructor()->getMock();
@@ -140,10 +142,10 @@ public function getCommandByIdentifierThrowsExceptionIfMoreThanOneMatchingComman
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\AmbiguousCommandIdentifierException
*/
public function getCommandByIdentifierThrowsExceptionIfOnlyPackageKeyIsSpecifiedAndContainsMoreThanOneCommand()
{
+ $this->expectException(AmbiguousCommandIdentifierException::class);
$mockCommand1 = $this->getMockBuilder(Cli\Command::class)->disableOriginalConstructor()->getMock();
$mockCommand1->expects($this->atLeastOnce())->method('getCommandIdentifier')->will($this->returnValue('package.key:controller:command'));
$mockCommand2 = $this->getMockBuilder(Cli\Command::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Cli/CommandTest.php b/Neos.Flow/Tests/Unit/Cli/CommandTest.php
index 75556a90dc..39252e35f8 100644
--- a/Neos.Flow/Tests/Unit/Cli/CommandTest.php
+++ b/Neos.Flow/Tests/Unit/Cli/CommandTest.php
@@ -36,7 +36,7 @@ class CommandTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->command = $this->getAccessibleMock(Cli\Command::class, ['getCommandMethodReflection'], [], '', false);
$this->methodReflection = $this->createMock(MethodReflection::class, [], [__CLASS__, 'dummyMethod']);
diff --git a/Neos.Flow/Tests/Unit/Cli/ConsoleOutputTest.php b/Neos.Flow/Tests/Unit/Cli/ConsoleOutputTest.php
index b530bca975..5f5d03823f 100644
--- a/Neos.Flow/Tests/Unit/Cli/ConsoleOutputTest.php
+++ b/Neos.Flow/Tests/Unit/Cli/ConsoleOutputTest.php
@@ -40,7 +40,7 @@ class ConsoleOutputTest extends UnitTestCase
/**
* @return void
*/
- public function setUp(): void
+ protected function setUp(): void
{
$this->input = new ArrayInput([]);
$this->answerNothing();
diff --git a/Neos.Flow/Tests/Unit/Cli/RequestBuilderTest.php b/Neos.Flow/Tests/Unit/Cli/RequestBuilderTest.php
index a6d0d3066d..eed551a380 100644
--- a/Neos.Flow/Tests/Unit/Cli/RequestBuilderTest.php
+++ b/Neos.Flow/Tests/Unit/Cli/RequestBuilderTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Command\HelpCommandController;
+use Neos\Flow\Mvc\Exception\InvalidArgumentMixingException;
use Neos\Flow\Mvc\Exception\NoSuchCommandException;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Reflection\ReflectionService;
@@ -52,7 +53,7 @@ class RequestBuilderTest extends UnitTestCase
* Sets up this test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$this->mockObjectManager->expects($this->any())->method('getObjectNameByClassName')->with('Acme\Test\Command\DefaultCommandController')->will($this->returnValue('Acme\Test\Command\DefaultCommandController'));
@@ -299,10 +300,10 @@ public function exceedingArgumentsMayBeSpecified()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidArgumentMixingException
*/
public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed()
{
+ $this->expectException(InvalidArgumentMixingException::class);
$methodParameters = [
'testArgument1' => ['optional' => false, 'type' => 'string'],
'testArgument2' => ['optional' => false, 'type' => 'string'],
@@ -314,10 +315,10 @@ public function ifNamedArgumentsAreUsedAllRequiredArgumentsMustBeNamed()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidArgumentMixingException
*/
public function ifUnnamedArgumentsAreUsedAllRequiredArgumentsMustBeUnnamed()
{
+ $this->expectException(InvalidArgumentMixingException::class);
$methodParameters = [
'requiredArgument1' => ['optional' => false, 'type' => 'string'],
'requiredArgument2' => ['optional' => false, 'type' => 'string'],
diff --git a/Neos.Flow/Tests/Unit/Configuration/ConfigurationManagerTest.php b/Neos.Flow/Tests/Unit/Configuration/ConfigurationManagerTest.php
index 9f33a8963d..e2a28a1fac 100644
--- a/Neos.Flow/Tests/Unit/Configuration/ConfigurationManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Configuration/ConfigurationManagerTest.php
@@ -12,6 +12,9 @@
*/
use Neos\Flow\Configuration\ConfigurationManager;
+use Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException;
+use Neos\Flow\Configuration\Exception\ParseErrorException;
+use Neos\Flow\Configuration\Exception\RecursionException;
use Neos\Flow\Configuration\RouteConfigurationProcessor;
use Neos\Flow\Configuration\Source\YamlSource;
use Neos\Flow\Core\ApplicationContext;
@@ -31,7 +34,7 @@ class ConfigurationManagerTest extends UnitTestCase
*/
protected $mockContext;
- public function setUp()
+ protected function setUp(): void
{
$this->mockContext = $this->getMockBuilder(ApplicationContext::class)->disableOriginalConstructor()->getMock();
}
@@ -146,10 +149,10 @@ public function getConfigurationForRoutesAndCachesReturnsRespectiveConfiguration
/**
* @test
- * @expectedException \Neos\Flow\Configuration\Exception\InvalidConfigurationTypeException
*/
public function gettingUnregisteredConfigurationTypeFails()
{
+ $this->expectException(InvalidConfigurationTypeException::class);
$configurationManager = new ConfigurationManager(new ApplicationContext('Testing'));
$configurationManager->getConfiguration('Custom');
}
@@ -178,11 +181,11 @@ public function getConfigurationForCustomConfigurationUsingSettingsProcessingRet
}
/**
- * @expectedException \InvalidArgumentException
* @test
*/
public function registerConfigurationTypeThrowsExceptionOnInvalidConfigurationProcessingType()
{
+ $this->expectException(\InvalidArgumentException::class);
$configurationManager = $this->getAccessibleMock(ConfigurationManager::class, ['loadConfiguration'], [], '', false);
$configurationManager->registerConfigurationType('MyCustomType', 'Nonsense');
}
@@ -685,8 +688,8 @@ public function replaceVariablesInPhpStringReplacesConstantMarkersByRealGlobalCo
$settingsPhpString = var_export($settings, true);
$configurationManager = $this->getAccessibleMock(ConfigurationManager::class, ['dummy'], [], '', false);
$processedPhpString = $configurationManager->_call('replaceVariablesInPhpString', $settingsPhpString);
- $this->assertContains("'baz' => (defined('PHP_VERSION') ? constant('PHP_VERSION') : null)", $processedPhpString);
- $this->assertContains("'to' => (defined('FLOW_PATH_ROOT') ? constant('FLOW_PATH_ROOT') : null)", $processedPhpString);
+ $this->assertStringContainsString("'baz' => (defined('PHP_VERSION') ? constant('PHP_VERSION') : null)", $processedPhpString);
+ $this->assertStringContainsString("'to' => (defined('FLOW_PATH_ROOT') ? constant('FLOW_PATH_ROOT') : null)", $processedPhpString);
}
/**
@@ -708,10 +711,10 @@ public function replaceVariablesInPhpStringMaintainsConstantTypeIfOnlyValue()
$configurationManager = $this->getAccessibleMock(ConfigurationManager::class, ['dummy'], [], '', false);
$processedPhpString = $configurationManager->_call('replaceVariablesInPhpString', $settingsPhpString);
$settings = eval('return ' . $processedPhpString . ';');
- $this->assertInternalType('integer', $settings['anIntegerConstant']);
+ $this->assertIsInt($settings['anIntegerConstant']);
$this->assertSame(PHP_VERSION_ID, $settings['anIntegerConstant']);
- $this->assertInternalType('string', $settings['casted']['to']['string']);
+ $this->assertIsString($settings['casted']['to']['string']);
$this->assertSame('Version id is ' . PHP_VERSION_ID, $settings['casted']['to']['string']);
}
@@ -1176,10 +1179,10 @@ public function packageRoutesAndSettingsCallback($filenameAndPath)
/**
* @test
- * @expectedException \Neos\Flow\Configuration\Exception\RecursionException
*/
public function loadConfigurationForRoutesThrowsExceptionIfSubRoutesContainCircularReferences()
{
+ $this->expectException(RecursionException::class);
$mockSubRouteConfiguration =
[
'name' => 'SomeRouteOrSubRoute',
@@ -1203,10 +1206,10 @@ public function loadConfigurationForRoutesThrowsExceptionIfSubRoutesContainCircu
/**
* @test
- * @expectedException \Neos\Flow\Configuration\Exception\ParseErrorException
*/
public function mergeRoutesWithSubRoutesThrowsExceptionIfRouteRefersToNonExistingOrInactivePackages()
{
+ $this->expectException(ParseErrorException::class);
$routesConfiguration = [
[
'name' => 'Welcome',
diff --git a/Neos.Flow/Tests/Unit/Configuration/Source/YamlSourceTest.php b/Neos.Flow/Tests/Unit/Configuration/Source/YamlSourceTest.php
index 1cc0b9056d..7742469a0f 100644
--- a/Neos.Flow/Tests/Unit/Configuration/Source/YamlSourceTest.php
+++ b/Neos.Flow/Tests/Unit/Configuration/Source/YamlSourceTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Configuration\Exception;
use org\bovigo\vfs\vfsStream;
use Neos\Flow\Configuration\Source\YamlSource;
use Neos\Flow\Tests\UnitTestCase;
@@ -25,7 +26,7 @@ class YamlSourceTest extends UnitTestCase
* Sets up this test case
*
*/
- protected function setUp()
+ protected function setUp(): void
{
vfsStream::setup('testDirectory');
}
@@ -67,7 +68,7 @@ public function saveWritesArrayToGivenFileAsYAML()
$configurationSource->save($pathAndFilename, $mockConfiguration);
$yaml = 'configurationFileHasBeenLoaded: true' . chr(10) . 'foo:' . chr(10) . ' bar: Baz' . chr(10);
- $this->assertContains($yaml, file_get_contents($pathAndFilename . '.yaml'), 'Configuration was not written to the file as expected.');
+ $this->assertStringContainsString($yaml, file_get_contents($pathAndFilename . '.yaml'), 'Configuration was not written to the file as expected.');
}
/**
@@ -86,7 +87,7 @@ public function saveKeepsQuotedKey()
$configurationSource->save($pathAndFilename, $mockConfiguration);
$yaml = 'configurationFileHasBeenLoaded: true' . chr(10) . 'foo:' . chr(10) . ' \'Foo.Bar:Baz\': \'a quoted key\'' . chr(10);
- $this->assertContains($yaml, file_get_contents($pathAndFilename . '.yaml'), 'Configuration was not written to the file as expected.');
+ $this->assertStringContainsString($yaml, file_get_contents($pathAndFilename . '.yaml'), 'Configuration was not written to the file as expected.');
}
/**
@@ -102,8 +103,8 @@ public function saveDoesNotOverwriteExistingHeaderCommentsIfFileExists()
$configurationSource->save($pathAndFilename, ['configurationFileHasBeenLoaded' => true]);
$yaml = file_get_contents($pathAndFilename . '.yaml');
- $this->assertContains('# This comment should stay' . chr(10) . chr(10), $yaml, 'Header comment was removed from file.');
- $this->assertNotContains('Test: foo', $yaml);
+ $this->assertStringContainsString('# This comment should stay' . chr(10) . chr(10), $yaml, 'Header comment was removed from file.');
+ $this->assertStringNotContainsString('Test: foo', $yaml);
}
/**
@@ -153,10 +154,10 @@ public function splitConfigurationFilesAreMergedAsExpected()
/**
* @test
- * @expectedException \Neos\Flow\Configuration\Exception
*/
public function configurationFileWithYmlExtensionResultsInException()
{
+ $this->expectException(Exception::class);
$pathAndFilename = __DIR__ . '/../Fixture/YmlThrowsException';
$configurationSource = new YamlSource();
$configurationSource->load($pathAndFilename, true);
diff --git a/Neos.Flow/Tests/Unit/Core/ApplicationContextTest.php b/Neos.Flow/Tests/Unit/Core/ApplicationContextTest.php
index fd3a064805..9ca4437496 100644
--- a/Neos.Flow/Tests/Unit/Core/ApplicationContextTest.php
+++ b/Neos.Flow/Tests/Unit/Core/ApplicationContextTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Core\ApplicationContext;
+use Neos\Flow\Exception;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -65,10 +66,10 @@ public function forbiddenContexts()
/**
* @test
* @dataProvider forbiddenContexts
- * @expectedException \Neos\Flow\Exception
*/
public function constructorThrowsExceptionIfMainContextIsForbidden($forbiddenContext)
{
+ $this->expectException(Exception::class);
new ApplicationContext($forbiddenContext);
}
diff --git a/Neos.Flow/Tests/Unit/Core/Booting/ScriptsTest.php b/Neos.Flow/Tests/Unit/Core/Booting/ScriptsTest.php
index d07c0cd1a6..b567cdc035 100644
--- a/Neos.Flow/Tests/Unit/Core/Booting/ScriptsTest.php
+++ b/Neos.Flow/Tests/Unit/Core/Booting/ScriptsTest.php
@@ -26,7 +26,7 @@ class ScriptsTest extends UnitTestCase
/**
*/
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->scriptsMock = $this->getAccessibleMock(Scripts::class, ['dummy']);
@@ -44,22 +44,22 @@ public function subProcessCommandEvaluatesIniFileUsageSettingCorrectly()
$message = 'The command must contain the current ini because it is not explicitly set in settings.';
$actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings);
- $this->assertContains(sprintf(' -c %s ', escapeshellarg(php_ini_loaded_file())), $actual, $message);
+ $this->assertStringContainsString(sprintf(' -c %s ', escapeshellarg(php_ini_loaded_file())), $actual, $message);
$settings['core']['subRequestPhpIniPathAndFilename'] = null;
$message = 'The command must contain the current ini because it is explicitly set, but NULL, in settings.';
$actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings);
- $this->assertContains(sprintf(' -c %s ', escapeshellarg(php_ini_loaded_file())), $actual, $message);
+ $this->assertStringContainsString(sprintf(' -c %s ', escapeshellarg(php_ini_loaded_file())), $actual, $message);
$settings['core']['subRequestPhpIniPathAndFilename'] = '/foo/ini/path';
$message = 'The command must contain a specified ini file path because it is set in settings.';
$actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings);
- $this->assertContains(sprintf(' -c %s ', escapeshellarg('/foo/ini/path')), $actual, $message);
+ $this->assertStringContainsString(sprintf(' -c %s ', escapeshellarg('/foo/ini/path')), $actual, $message);
$settings['core']['subRequestPhpIniPathAndFilename'] = false;
$message = 'The command must not contain an ini file path because it is set to false in settings.';
$actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings);
- $this->assertNotContains(' -c ', $actual, $message);
+ $this->assertStringNotContainsString(' -c ', $actual, $message);
}
/**
@@ -74,7 +74,7 @@ public function subProcessCommandEvaluatesSubRequestIniEntriesCorrectly()
]];
$actual = $this->scriptsMock->_call('buildSubprocessCommand', 'flow:foo:identifier', $settings);
- $this->assertContains(sprintf(' -d %s=%s ', escapeshellarg('someSetting'), escapeshellarg('withValue')), $actual);
- $this->assertContains(sprintf(' -d %s ', escapeshellarg('someFlagSettingWithoutValue')), $actual);
+ $this->assertStringContainsString(sprintf(' -d %s=%s ', escapeshellarg('someSetting'), escapeshellarg('withValue')), $actual);
+ $this->assertStringContainsString(sprintf(' -d %s ', escapeshellarg('someFlagSettingWithoutValue')), $actual);
}
}
diff --git a/Neos.Flow/Tests/Unit/Core/BootstrapTest.php b/Neos.Flow/Tests/Unit/Core/BootstrapTest.php
index a285171022..033bc7eb80 100644
--- a/Neos.Flow/Tests/Unit/Core/BootstrapTest.php
+++ b/Neos.Flow/Tests/Unit/Core/BootstrapTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Core\Bootstrap;
+use Neos\Flow\Exception;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -53,10 +54,10 @@ public function isCompileTimeCommandControllerChecksIfTheGivenCommandIdentifierR
/**
* @test
- * @expectedException \Neos\Flow\Exception
*/
public function resolveRequestHandlerThrowsUsefulExceptionIfNoRequestHandlerFound()
{
+ $this->expectException(Exception::class);
$bootstrap = $this->getAccessibleMock(Bootstrap::class, ['dummy'], [], '', false);
$bootstrap->_call('resolveRequestHandler');
}
diff --git a/Neos.Flow/Tests/Unit/Core/ClassLoaderTest.php b/Neos.Flow/Tests/Unit/Core/ClassLoaderTest.php
index 67d247d385..dc21c6668a 100644
--- a/Neos.Flow/Tests/Unit/Core/ClassLoaderTest.php
+++ b/Neos.Flow/Tests/Unit/Core/ClassLoaderTest.php
@@ -58,7 +58,7 @@ class ClassLoaderTest extends UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
if (FLOW_ONLY_COMPOSER_LOADER) {
$this->markTestSkipped('Not testing if composer-only loading is requested.');
diff --git a/Neos.Flow/Tests/Unit/Core/LockManagerTest.php b/Neos.Flow/Tests/Unit/Core/LockManagerTest.php
index aec9908b3f..a35f565407 100644
--- a/Neos.Flow/Tests/Unit/Core/LockManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Core/LockManagerTest.php
@@ -43,7 +43,7 @@ class LockManagerTest extends UnitTestCase
protected $mockLockFlagFile;
- public function setUp()
+ protected function setUp(): void
{
$this->mockLockDirectory = vfsStream::setup('LockPath');
$this->mockLockFile = vfsStream::newFile(md5(FLOW_PATH_ROOT) . '_Flow.lock')->at($this->mockLockDirectory);
diff --git a/Neos.Flow/Tests/Unit/Error/DebuggerTest.php b/Neos.Flow/Tests/Unit/Error/DebuggerTest.php
index cbf611ca5b..9a6c754137 100644
--- a/Neos.Flow/Tests/Unit/Error/DebuggerTest.php
+++ b/Neos.Flow/Tests/Unit/Error/DebuggerTest.php
@@ -20,7 +20,7 @@
*/
class DebuggerTest extends UnitTestCase
{
- public function setUp()
+ protected function setUp(): void
{
Debugger::clearState();
}
@@ -51,7 +51,7 @@ public function considersProxyClassWhenIsProxyPropertyIsPresent()
public function ignoredClassesRegexContainsFallback()
{
$ignoredClassesRegex = Debugger::getIgnoredClassesRegex();
- $this->assertContains('Neos\\\\Flow\\\\Core\\\\.*', $ignoredClassesRegex);
+ $this->assertStringContainsString('Neos\\\\Flow\\\\Core\\\\.*', $ignoredClassesRegex);
}
/**
diff --git a/Neos.Flow/Tests/Unit/Http/BrowserTest.php b/Neos.Flow/Tests/Unit/Http/BrowserTest.php
index 4196147664..220681efff 100644
--- a/Neos.Flow/Tests/Unit/Http/BrowserTest.php
+++ b/Neos.Flow/Tests/Unit/Http/BrowserTest.php
@@ -29,7 +29,7 @@ class BrowserTest extends UnitTestCase
/**
*
*/
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->browser = new Client\Browser();
@@ -68,7 +68,7 @@ public function automaticHeadersAreSetOnEachRequest()
$this->assertTrue($this->browser->getLastRequest()->hasHeader('X-Test-Header'));
$this->assertSame('Acme', $this->browser->getLastRequest()->getHeader('X-Test-Header'));
- $this->assertContains('text/plain', $this->browser->getLastRequest()->getHeader('Content-Type'));
+ $this->assertStringContainsString('text/plain', $this->browser->getLastRequest()->getHeader('Content-Type'));
}
/**
@@ -143,10 +143,10 @@ public function browserDoesNotRedirectOnLocationHeaderButNot3xxResponseCode()
/**
* @test
- * @expectedException \Neos\Flow\Http\Client\InfiniteRedirectionException
*/
public function browserHaltsOnAttemptedInfiniteRedirectionLoop()
{
+ $this->expectException(Client\InfiniteRedirectionException::class);
$wildResponses = [];
$wildResponses[0] = new Http\Response();
$wildResponses[0]->setStatus(301);
@@ -175,10 +175,10 @@ public function browserHaltsOnAttemptedInfiniteRedirectionLoop()
/**
* @test
- * @expectedException \Neos\Flow\Http\Client\InfiniteRedirectionException
*/
public function browserHaltsOnExceedingMaximumRedirections()
{
+ $this->expectException(Client\InfiniteRedirectionException::class);
$requestEngine = $this->createMock(Client\RequestEngineInterface::class);
for ($i=0; $i<=10; $i++) {
$response = new Http\Response();
diff --git a/Neos.Flow/Tests/Unit/Http/Component/ComponentChainFactoryTest.php b/Neos.Flow/Tests/Unit/Http/Component/ComponentChainFactoryTest.php
index 664c102ca6..346b0ad9bf 100644
--- a/Neos.Flow/Tests/Unit/Http/Component/ComponentChainFactoryTest.php
+++ b/Neos.Flow/Tests/Unit/Http/Component/ComponentChainFactoryTest.php
@@ -35,7 +35,7 @@ class ComponentChainFactoryTest extends UnitTestCase
*/
protected $mockComponent;
- public function setUp()
+ protected function setUp(): void
{
$this->componentChainFactory = new Http\Component\ComponentChainFactory();
@@ -73,10 +73,10 @@ public function createInitializesComponentsInTheRightOrderAccordingToThePosition
/**
* @test
- * @expectedException \Neos\Flow\Http\Component\Exception
*/
public function createThrowsExceptionIfComponentClassNameIsNotConfigured()
{
+ $this->expectException(Http\Component\Exception::class);
$chainConfiguration = [
'foo' => [
'position' => 'start',
@@ -88,10 +88,10 @@ public function createThrowsExceptionIfComponentClassNameIsNotConfigured()
/**
* @test
- * @expectedException \Neos\Flow\Http\Component\Exception
*/
public function createThrowsExceptionIfComponentClassNameDoesNotImplementComponentInterface()
{
+ $this->expectException(Http\Component\Exception::class);
$chainConfiguration = [
'foo' => [
'component' => 'Foo\Component\ClassName',
diff --git a/Neos.Flow/Tests/Unit/Http/Component/ComponentChainTest.php b/Neos.Flow/Tests/Unit/Http/Component/ComponentChainTest.php
index 4b14d9b876..dcc82fd65e 100644
--- a/Neos.Flow/Tests/Unit/Http/Component/ComponentChainTest.php
+++ b/Neos.Flow/Tests/Unit/Http/Component/ComponentChainTest.php
@@ -29,7 +29,7 @@ class ComponentChainTest extends UnitTestCase
*/
protected $mockComponentContext;
- public function setUp()
+ protected function setUp(): void
{
$this->mockComponentContext = $this->getMockBuilder(Http\Component\ComponentContext::class)->disableOriginalConstructor()->getMock();
}
diff --git a/Neos.Flow/Tests/Unit/Http/Component/ComponentContextTest.php b/Neos.Flow/Tests/Unit/Http/Component/ComponentContextTest.php
index 34de17c7c3..304c12105e 100644
--- a/Neos.Flow/Tests/Unit/Http/Component/ComponentContextTest.php
+++ b/Neos.Flow/Tests/Unit/Http/Component/ComponentContextTest.php
@@ -34,7 +34,7 @@ class ComponentContextTest extends UnitTestCase
*/
protected $mockHttpResponse;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest = $this->getMockBuilder(Http\Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpResponse = $this->getMockBuilder(Http\Response::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Http/Component/StandardsComplianceComponentTest.php b/Neos.Flow/Tests/Unit/Http/Component/StandardsComplianceComponentTest.php
index 2331a135f3..9ffa5d0e8b 100644
--- a/Neos.Flow/Tests/Unit/Http/Component/StandardsComplianceComponentTest.php
+++ b/Neos.Flow/Tests/Unit/Http/Component/StandardsComplianceComponentTest.php
@@ -39,7 +39,7 @@ class StandardsComplianceComponentTest extends UnitTestCase
*/
protected $mockHttpResponse;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest = $this->getMockBuilder(Http\Request::class)->disableOriginalConstructor()->getMock();
$this->response = new Http\Response();
diff --git a/Neos.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php b/Neos.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php
index 7bf7dc37f4..49edb88115 100644
--- a/Neos.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php
+++ b/Neos.Flow/Tests/Unit/Http/Component/TrustedProxiesComponentTest.php
@@ -48,7 +48,7 @@ class TrustedProxiesComponentTest extends UnitTestCase
*/
protected $mockHttpResponse;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpResponse = $this->getMockBuilder(Response::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Http/ContentStreamTest.php b/Neos.Flow/Tests/Unit/Http/ContentStreamTest.php
index ee05a45add..1f048bc140 100644
--- a/Neos.Flow/Tests/Unit/Http/ContentStreamTest.php
+++ b/Neos.Flow/Tests/Unit/Http/ContentStreamTest.php
@@ -22,10 +22,10 @@ class ContentStreamTest extends UnitTestCase
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructorThrowsExceptionWhenBeingPassedAnInvalidResource()
{
+ $this->expectException(\InvalidArgumentException::class);
new ContentStream('invalid resource');
}
diff --git a/Neos.Flow/Tests/Unit/Http/CookieTest.php b/Neos.Flow/Tests/Unit/Http/CookieTest.php
index fa8ed57e3a..4a33eb956e 100644
--- a/Neos.Flow/Tests/Unit/Http/CookieTest.php
+++ b/Neos.Flow/Tests/Unit/Http/CookieTest.php
@@ -62,10 +62,10 @@ public function validCookieNames()
* @param string $cookieName
* @test
* @dataProvider invalidCookieNames
- * @expectedException \InvalidArgumentException
*/
public function constructorThrowsExceptionOnInvalidCookieNames($cookieName)
{
+ $this->expectException(\InvalidArgumentException::class);
new Cookie($cookieName);
}
@@ -117,10 +117,10 @@ public function invalidExpiresParameters()
* @param mixed $parameter
* @test
* @dataProvider invalidExpiresParameters
- * @expectedException \InvalidArgumentException
*/
public function constructorThrowsExceptionOnInvalidExpiresParameter($parameter)
{
+ $this->expectException(\InvalidArgumentException::class);
new Cookie('foo', 'bar', $parameter);
}
@@ -141,10 +141,10 @@ public function getExpiresAlwaysReturnsAUnixTimestamp()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructorThrowsExceptionOnInvalidMaximumAgeParameter()
{
+ $this->expectException(\InvalidArgumentException::class);
new Cookie('foo', 'bar', 0, 'urks');
}
@@ -179,10 +179,10 @@ public function invalidDomains()
* @param mixed $domain
* @test
* @dataProvider invalidDomains
- * @expectedException \InvalidArgumentException
*/
public function constructorThrowsExceptionOnInvalidDomain($domain)
{
+ $this->expectException(\InvalidArgumentException::class);
new Cookie('foo', 'bar', 0, null, $domain);
}
@@ -212,10 +212,10 @@ public function invalidPaths()
* @param mixed $path
* @test
* @dataProvider invalidPaths
- * @expectedException \InvalidArgumentException
*/
public function constructorThrowsExceptionOnInvalidPath($path)
{
+ $this->expectException(\InvalidArgumentException::class);
new Cookie('foo', 'bar', 0, null, null, $path);
}
diff --git a/Neos.Flow/Tests/Unit/Http/RequestTest.php b/Neos.Flow/Tests/Unit/Http/RequestTest.php
index cf95982927..92f2d31fd9 100644
--- a/Neos.Flow/Tests/Unit/Http/RequestTest.php
+++ b/Neos.Flow/Tests/Unit/Http/RequestTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Http\Exception;
use Neos\Flow\Http\Helper\UploadedFilesHelper;
use Neos\Flow\Http\Request;
use Neos\Flow\Http\Uri;
@@ -342,10 +343,10 @@ public function getContentReturnsTheRequestBodyContentAsResourcePointerIfRequest
/**
* @test
- * @expectedException \Neos\Flow\Http\Exception
*/
public function getContentThrowsAnExceptionOnTryingToRetrieveContentAsResourceAlthoughItHasBeenRetrievedPreviously()
{
+ $this->expectException(Exception::class);
vfsStream::setup('Foo');
file_put_contents('vfs://Foo/content.txt', 'xy');
diff --git a/Neos.Flow/Tests/Unit/Http/ResponseTest.php b/Neos.Flow/Tests/Unit/Http/ResponseTest.php
index 02ffa34fde..9c23a7faf8 100644
--- a/Neos.Flow/Tests/Unit/Http/ResponseTest.php
+++ b/Neos.Flow/Tests/Unit/Http/ResponseTest.php
@@ -126,10 +126,10 @@ public function createFromRawSetsCookiesCorrectly()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function createFromRawThrowsExceptionOnFirstLine()
{
+ $this->expectException(\InvalidArgumentException::class);
Response::createFromRaw('No valid response');
}
@@ -177,10 +177,10 @@ public function setStatusReturnsUnknownStatusMessageOnInvalidCode()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setStatusThrowsExceptionOnNonNumericCode()
{
+ $this->expectException(\InvalidArgumentException::class);
$response = new Response();
$response->setStatus('400');
}
diff --git a/Neos.Flow/Tests/Unit/Http/UriTest.php b/Neos.Flow/Tests/Unit/Http/UriTest.php
index b63267cd59..55a3c24916 100644
--- a/Neos.Flow/Tests/Unit/Http/UriTest.php
+++ b/Neos.Flow/Tests/Unit/Http/UriTest.php
@@ -153,10 +153,10 @@ public function settingValidHostPassesRegexCheck($uriString, $plainHost)
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function settingInvalidHostThrowsException()
{
+ $this->expectException(\InvalidArgumentException::class);
$uri = new Uri('');
$uri->setHost('an#invalid.host');
}
@@ -182,19 +182,19 @@ public function stringRepresentationIsCorrect($uriString)
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructingWithNotAStringThrowsException()
{
+ $this->expectException(\InvalidArgumentException::class);
new Uri(42);
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function unparsableUriStringThrowsException()
{
+ $this->expectException(\InvalidArgumentException::class);
new Uri('http:////localhost');
}
}
diff --git a/Neos.Flow/Tests/Unit/I18n/AbstractXmlParserTest.php b/Neos.Flow/Tests/Unit/I18n/AbstractXmlParserTest.php
index 6d8c5c55d8..c33e9c8d98 100644
--- a/Neos.Flow/Tests/Unit/I18n/AbstractXmlParserTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/AbstractXmlParserTest.php
@@ -33,10 +33,10 @@ public function invokesDoParsingFromRootMethodForActualParsing()
/**
* @test
- * @expectedException \Neos\Flow\I18n\Exception\InvalidXmlFileException
*/
public function throwsExceptionWhenBadFilenameGiven()
{
+ $this->expectException(I18n\Exception\InvalidXmlFileException::class);
$mockFilenamePath = 'foo';
$parser = $this->getAccessibleMock(I18n\AbstractXmlParser::class, ['doParsingFromRoot']);
diff --git a/Neos.Flow/Tests/Unit/I18n/Cldr/CldrModelTest.php b/Neos.Flow/Tests/Unit/I18n/Cldr/CldrModelTest.php
index a32d8da34b..ac7735eef1 100644
--- a/Neos.Flow/Tests/Unit/I18n/Cldr/CldrModelTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Cldr/CldrModelTest.php
@@ -28,7 +28,7 @@ class CldrModelTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$samplePaths = ['foo', 'bar', 'baz'];
$sampleParsedFile1 = require(__DIR__ . '/../Fixtures/MockParsedCldrFile1.php');
diff --git a/Neos.Flow/Tests/Unit/I18n/Cldr/CldrRepositoryTest.php b/Neos.Flow/Tests/Unit/I18n/Cldr/CldrRepositoryTest.php
index 49145f73f2..9c2b882c2a 100644
--- a/Neos.Flow/Tests/Unit/I18n/Cldr/CldrRepositoryTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Cldr/CldrRepositoryTest.php
@@ -33,7 +33,7 @@ class CldrRepositoryTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
diff --git a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/CurrencyReaderTest.php b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/CurrencyReaderTest.php
index ce00768c89..7217416706 100644
--- a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/CurrencyReaderTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/CurrencyReaderTest.php
@@ -29,7 +29,7 @@ class CurrencyReaderTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$sampleCurrencyFractionsData = [
'fractions' => [
diff --git a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/DatesReaderTest.php b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/DatesReaderTest.php
index 1cb642bbe5..7589b286fb 100644
--- a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/DatesReaderTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/DatesReaderTest.php
@@ -14,6 +14,7 @@
use Neos\Cache\Frontend\VariableFrontend;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\I18n;
+use PHPUnit\Framework\MockObject\MockObject;
/**
* Testcase for the DatesReader
@@ -30,7 +31,7 @@ class DatesReaderTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en');
}
@@ -39,10 +40,10 @@ public function setUp()
* Setting cache expectations is partially same for many tests, so it's been
* extracted to this method.
*
- * @param \PHPUnit_Framework_MockObject_MockObject $mockCache
+ * @param MockObject $mockCache
* @return array
*/
- public function createCacheExpectations(\PHPUnit_Framework_MockObject_MockObject $mockCache)
+ public function createCacheExpectations(MockObject $mockCache)
{
$mockCache->expects($this->at(0))->method('has')->with('parsedFormats')->will($this->returnValue(true));
$mockCache->expects($this->at(1))->method('has')->with('parsedFormatsIndices')->will($this->returnValue(true));
diff --git a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/NumbersReaderTest.php b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/NumbersReaderTest.php
index 3473a8c2f2..0023e99e92 100644
--- a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/NumbersReaderTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/NumbersReaderTest.php
@@ -55,7 +55,7 @@ class NumbersReaderTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en');
}
@@ -140,10 +140,10 @@ public function unsupportedFormats()
/**
* @test
* @dataProvider unsupportedFormats
- * @expectedException \Neos\Flow\I18n\Cldr\Reader\Exception\UnsupportedNumberFormatException
*/
public function throwsExceptionWhenUnsupportedFormatsEncountered($format)
{
+ $this->expectException(I18n\Cldr\Reader\Exception\UnsupportedNumberFormatException::class);
$reader = $this->getAccessibleMock(I18n\Cldr\Reader\NumbersReader::class, ['dummy']);
$reader->_call('parseFormat', $format);
diff --git a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/PluralsReaderTest.php b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/PluralsReaderTest.php
index 690b4cd841..2af192ef68 100644
--- a/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/PluralsReaderTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Cldr/Reader/PluralsReaderTest.php
@@ -29,7 +29,7 @@ class PluralsReaderTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$samplePluralRulesData = [
'pluralRules[@locales="ro mo"]' => [
diff --git a/Neos.Flow/Tests/Unit/I18n/DetectorTest.php b/Neos.Flow/Tests/Unit/I18n/DetectorTest.php
index d78d249d92..2b878a89c6 100644
--- a/Neos.Flow/Tests/Unit/I18n/DetectorTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/DetectorTest.php
@@ -27,7 +27,7 @@ class DetectorTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$findBestMatchingLocaleCallback = function () {
$args = func_get_args();
diff --git a/Neos.Flow/Tests/Unit/I18n/FormatResolverTest.php b/Neos.Flow/Tests/Unit/I18n/FormatResolverTest.php
index 398e066739..8dbe62fe49 100644
--- a/Neos.Flow/Tests/Unit/I18n/FormatResolverTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/FormatResolverTest.php
@@ -29,7 +29,7 @@ class FormatResolverTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en_GB');
}
@@ -65,30 +65,30 @@ public function returnsStringCastedArgumentWhenFormatterNameIsNotSet()
/**
* @test
- * @expectedException \Neos\Flow\I18n\Exception\InvalidFormatPlaceholderException
*/
public function throwsExceptionWhenInvalidPlaceholderEncountered()
{
+ $this->expectException(I18n\Exception\InvalidFormatPlaceholderException::class);
$formatResolver = new I18n\FormatResolver();
$formatResolver->resolvePlaceholders('{0,damaged {1}', [], $this->sampleLocale);
}
/**
* @test
- * @expectedException \Neos\Flow\I18n\Exception\IndexOutOfBoundsException
*/
public function throwsExceptionWhenInsufficientNumberOfArgumentsProvided()
{
+ $this->expectException(I18n\Exception\IndexOutOfBoundsException::class);
$formatResolver = new I18n\FormatResolver();
$formatResolver->resolvePlaceholders('{0}', [], $this->sampleLocale);
}
/**
* @test
- * @expectedException \Neos\Flow\I18n\Exception\UnknownFormatterException
*/
public function throwsExceptionWhenFormatterDoesNotExist()
{
+ $this->expectException(I18n\Exception\UnknownFormatterException::class);
$mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$mockObjectManager
->expects($this->at(0))
@@ -109,10 +109,10 @@ public function throwsExceptionWhenFormatterDoesNotExist()
/**
* @test
- * @expectedException \Neos\Flow\I18n\Exception\InvalidFormatterException
*/
public function throwsExceptionWhenFormatterDoesNotImplementFormatterInterface()
{
+ $this->expectException(I18n\Exception\InvalidFormatterException::class);
$mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$mockObjectManager
->expects($this->once())
diff --git a/Neos.Flow/Tests/Unit/I18n/Formatter/DatetimeFormatterTest.php b/Neos.Flow/Tests/Unit/I18n/Formatter/DatetimeFormatterTest.php
index 48cb21934a..db9c03b4f8 100644
--- a/Neos.Flow/Tests/Unit/I18n/Formatter/DatetimeFormatterTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Formatter/DatetimeFormatterTest.php
@@ -46,7 +46,7 @@ class DatetimeFormatterTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en');
$this->sampleLocalizedLiterals = require(__DIR__ . '/../Fixtures/MockLocalizedLiteralsArray.php');
diff --git a/Neos.Flow/Tests/Unit/I18n/Formatter/NumberFormatterTest.php b/Neos.Flow/Tests/Unit/I18n/Formatter/NumberFormatterTest.php
index 1bf556490d..833cb796d8 100644
--- a/Neos.Flow/Tests/Unit/I18n/Formatter/NumberFormatterTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Formatter/NumberFormatterTest.php
@@ -79,7 +79,7 @@ class NumberFormatterTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en');
}
diff --git a/Neos.Flow/Tests/Unit/I18n/LocaleCollectionTest.php b/Neos.Flow/Tests/Unit/I18n/LocaleCollectionTest.php
index bdbe8f33aa..f44a660fcc 100644
--- a/Neos.Flow/Tests/Unit/I18n/LocaleCollectionTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/LocaleCollectionTest.php
@@ -32,7 +32,7 @@ class LocaleCollectionTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->locales = [
new I18n\Locale('en'),
diff --git a/Neos.Flow/Tests/Unit/I18n/LocaleTest.php b/Neos.Flow/Tests/Unit/I18n/LocaleTest.php
index 050ae10f03..5e172d7272 100644
--- a/Neos.Flow/Tests/Unit/I18n/LocaleTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/LocaleTest.php
@@ -36,10 +36,10 @@ public function invalidLocaleIdentifiers()
/**
* @test
* @dataProvider invalidLocaleIdentifiers
- * @expectedException \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException
*/
public function theConstructorThrowsAnExceptionOnPassingAInvalidLocaleIdentifiers($invalidIdentifier)
{
+ $this->expectException(I18n\Exception\InvalidLocaleIdentifierException::class);
new I18n\Locale($invalidIdentifier);
}
diff --git a/Neos.Flow/Tests/Unit/I18n/LocaleTypeConverterTest.php b/Neos.Flow/Tests/Unit/I18n/LocaleTypeConverterTest.php
index 11a8484701..a857320a39 100644
--- a/Neos.Flow/Tests/Unit/I18n/LocaleTypeConverterTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/LocaleTypeConverterTest.php
@@ -28,7 +28,7 @@ class LocaleTypeConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new LocaleTypeConverter();
}
diff --git a/Neos.Flow/Tests/Unit/I18n/Parser/DatetimeParserTest.php b/Neos.Flow/Tests/Unit/I18n/Parser/DatetimeParserTest.php
index f4c2338912..4978190e1d 100644
--- a/Neos.Flow/Tests/Unit/I18n/Parser/DatetimeParserTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Parser/DatetimeParserTest.php
@@ -48,7 +48,7 @@ class DatetimeParserTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en_GB');
$this->sampleLocalizedLiterals = require(__DIR__ . '/../Fixtures/MockLocalizedLiteralsArray.php');
diff --git a/Neos.Flow/Tests/Unit/I18n/Parser/NumberParserTest.php b/Neos.Flow/Tests/Unit/I18n/Parser/NumberParserTest.php
index 52b01ac462..47d3afd7fd 100644
--- a/Neos.Flow/Tests/Unit/I18n/Parser/NumberParserTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Parser/NumberParserTest.php
@@ -67,7 +67,7 @@ class NumberParserTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->sampleLocale = new I18n\Locale('en_GB');
}
diff --git a/Neos.Flow/Tests/Unit/I18n/ServiceTest.php b/Neos.Flow/Tests/Unit/I18n/ServiceTest.php
index d0162cd4c7..5edf91dee7 100644
--- a/Neos.Flow/Tests/Unit/I18n/ServiceTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/ServiceTest.php
@@ -26,7 +26,7 @@ class ServiceTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
}
diff --git a/Neos.Flow/Tests/Unit/I18n/TranslationProvider/XliffTranslationProviderTest.php b/Neos.Flow/Tests/Unit/I18n/TranslationProvider/XliffTranslationProviderTest.php
index bda00062ad..69635d4f55 100644
--- a/Neos.Flow/Tests/Unit/I18n/TranslationProvider/XliffTranslationProviderTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/TranslationProvider/XliffTranslationProviderTest.php
@@ -52,7 +52,7 @@ class XliffTranslationProviderTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->samplePackageKey = 'Neos.Flow';
$this->sampleSourceName = 'Foo';
@@ -113,10 +113,10 @@ public function returnsTranslatedLabelWhenLabelIdProvided()
/**
* @test
- * @expectedException \Neos\Flow\I18n\TranslationProvider\Exception\InvalidPluralFormException
*/
public function getTranslationByOriginalLabelThrowsExceptionWhenInvalidPluralFormProvided()
{
+ $this->expectException(I18n\TranslationProvider\Exception\InvalidPluralFormException::class);
$this->mockPluralsReader->expects($this->any())
->method('getPluralForms')
->with($this->sampleLocale)
@@ -130,10 +130,10 @@ public function getTranslationByOriginalLabelThrowsExceptionWhenInvalidPluralFor
/**
* @test
- * @expectedException \Neos\Flow\I18n\TranslationProvider\Exception\InvalidPluralFormException
*/
public function getTranslationByIdThrowsExceptionWhenInvalidPluralFormProvided()
{
+ $this->expectException(I18n\TranslationProvider\Exception\InvalidPluralFormException::class);
$this->mockPluralsReader->expects($this->any())
->method('getPluralForms')
->with($this->sampleLocale)
diff --git a/Neos.Flow/Tests/Unit/I18n/TranslatorTest.php b/Neos.Flow/Tests/Unit/I18n/TranslatorTest.php
index 5d58e81178..b78423c966 100644
--- a/Neos.Flow/Tests/Unit/I18n/TranslatorTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/TranslatorTest.php
@@ -34,7 +34,7 @@ class TranslatorTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->defaultLocale = new I18n\Locale('en_GB');
diff --git a/Neos.Flow/Tests/Unit/I18n/Xliff/Model/FileAdapterTest.php b/Neos.Flow/Tests/Unit/I18n/Xliff/Model/FileAdapterTest.php
index fc17a0f982..c348c3b0a2 100644
--- a/Neos.Flow/Tests/Unit/I18n/Xliff/Model/FileAdapterTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Xliff/Model/FileAdapterTest.php
@@ -28,7 +28,7 @@ class FileAdapterTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$mockParsedXliffData = require(__DIR__ . '/../../Fixtures/MockParsedXliffData.php');
$this->mockParsedXliffFile = $mockParsedXliffData[0];
diff --git a/Neos.Flow/Tests/Unit/I18n/Xliff/V12/XliffParserTest.php b/Neos.Flow/Tests/Unit/I18n/Xliff/V12/XliffParserTest.php
index 3e26b88847..6dcf927994 100644
--- a/Neos.Flow/Tests/Unit/I18n/Xliff/V12/XliffParserTest.php
+++ b/Neos.Flow/Tests/Unit/I18n/Xliff/V12/XliffParserTest.php
@@ -34,10 +34,10 @@ public function parsesXliffFileCorrectly()
/**
* @test
- * @expectedException \Neos\Flow\I18n\Xliff\Exception\InvalidXliffDataException
*/
public function missingIdInSingularTransUnitCausesException()
{
+ $this->expectException(I18n\Xliff\Exception\InvalidXliffDataException::class);
$mockFilenamePath = __DIR__ . '/../../Fixtures/MockInvalidXliffData.xlf';
$parser = new I18n\Xliff\V12\XliffParser();
@@ -46,10 +46,10 @@ public function missingIdInSingularTransUnitCausesException()
/**
* @test
- * @expectedException \Neos\Flow\I18n\Xliff\Exception\InvalidXliffDataException
*/
public function missingIdInPluralTransUnitCausesException()
{
+ $this->expectException(I18n\Xliff\Exception\InvalidXliffDataException::class);
$mockFilenamePath = __DIR__ . '/../../Fixtures/MockInvalidPluralXliffData.xlf';
$parser = new I18n\Xliff\V12\XliffParser();
diff --git a/Neos.Flow/Tests/Unit/Monitor/ChangeDetectionStrategy/ModificationTimeStrategyTest.php b/Neos.Flow/Tests/Unit/Monitor/ChangeDetectionStrategy/ModificationTimeStrategyTest.php
index 7455ed58c1..d0a170492d 100644
--- a/Neos.Flow/Tests/Unit/Monitor/ChangeDetectionStrategy/ModificationTimeStrategyTest.php
+++ b/Neos.Flow/Tests/Unit/Monitor/ChangeDetectionStrategy/ModificationTimeStrategyTest.php
@@ -32,7 +32,7 @@ class ModificationTimeStrategyTest extends \Neos\Flow\Tests\UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('testDirectory');
diff --git a/Neos.Flow/Tests/Unit/Monitor/FileMonitorTest.php b/Neos.Flow/Tests/Unit/Monitor/FileMonitorTest.php
index 7ee9b3402d..5b79b98c19 100644
--- a/Neos.Flow/Tests/Unit/Monitor/FileMonitorTest.php
+++ b/Neos.Flow/Tests/Unit/Monitor/FileMonitorTest.php
@@ -39,7 +39,7 @@ class FileMonitorTest extends UnitTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->unixStylePath = Files::getUnixStylePath(__DIR__);
$this->unixStylePathAndFilename = Files::getUnixStylePath(__FILE__);
diff --git a/Neos.Flow/Tests/Unit/Mvc/ActionRequestTest.php b/Neos.Flow/Tests/Unit/Mvc/ActionRequestTest.php
index f79f7634b3..bcf5e93c5c 100644
--- a/Neos.Flow/Tests/Unit/Mvc/ActionRequestTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/ActionRequestTest.php
@@ -13,6 +13,11 @@
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Http;
+use Neos\Flow\Mvc\Exception\InvalidActionNameException;
+use Neos\Flow\Mvc\Exception\InvalidArgumentNameException;
+use Neos\Flow\Mvc\Exception\InvalidArgumentTypeException;
+use Neos\Flow\Mvc\Exception\InvalidControllerNameException;
+use Neos\Flow\ObjectManagement\Exception\UnknownObjectException;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Package\PackageManager;
use Neos\Flow\Security\Cryptography\HashService;
@@ -35,7 +40,7 @@ class ActionRequestTest extends UnitTestCase
*/
protected $mockHttpRequest;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest = $this->getMockBuilder(Http\Request::class)->disableOriginalConstructor()->getMock();
$this->actionRequest = new ActionRequest($this->mockHttpRequest);
@@ -57,11 +62,11 @@ public function anHttpRequestOrActionRequestIsRequiredAsParentRequest()
}
/**
- * @expectedException \InvalidArgumentException
* @test
*/
public function constructorThrowsAnExceptionIfNoValidRequestIsPassed()
{
+ $this->expectException(\InvalidArgumentException::class);
new ActionRequest(new \stdClass());
}
@@ -237,10 +242,10 @@ public function setControllerObjectNameSplitsTheGivenObjectNameIntoItsParts($obj
/**
* @test
- * @expectedException \Neos\Flow\ObjectManagement\Exception\UnknownObjectException
*/
public function setControllerObjectNameThrowsExceptionOnUnknownObjectName()
{
+ $this->expectException(UnknownObjectException::class);
$mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$mockObjectManager->expects($this->any())->method('getCaseSensitiveObjectName')->will($this->returnValue(false));
@@ -347,10 +352,10 @@ public function invalidControllerNames()
* @test
* @param mixed $invalidControllerName
* @dataProvider invalidControllerNames
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidControllerNameException
*/
public function setControllerNameThrowsExceptionOnInvalidControllerNames($invalidControllerName)
{
+ $this->expectException(InvalidControllerNameException::class);
$this->actionRequest->setControllerName($invalidControllerName);
}
@@ -383,10 +388,10 @@ public function invalidActionNames()
* @test
* @param mixed $invalidActionName
* @dataProvider invalidActionNames
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidActionNameException
*/
public function setControllerActionNameThrowsExceptionOnInvalidActionNames($invalidActionName)
{
+ $this->expectException(InvalidActionNameException::class);
$this->actionRequest->setControllerActionName($invalidActionName);
}
@@ -429,19 +434,19 @@ public function aSingleArgumentCanBeSetWithSetArgumentAndRetrievedWithGetArgumen
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidArgumentNameException
*/
public function setArgumentThrowsAnExceptionOnInvalidArgumentNames()
{
+ $this->expectException(InvalidArgumentNameException::class);
$this->actionRequest->setArgument('', 'theValue');
}
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidArgumentTypeException
*/
public function setArgumentDoesNotAllowObjectValuesForRegularArguments()
{
+ $this->expectException(InvalidArgumentTypeException::class);
$this->actionRequest->setArgument('foo', new \stdClass());
}
@@ -533,10 +538,10 @@ public function cloneResetsTheStatusToNotDispatched()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidHashException
*/
public function getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid()
{
+ $this->expectException(InvalidHashException::class);
$serializedArguments = base64_encode('some manipulated arguments string without valid HMAC');
$referrer = [
'@controller' => 'Foo',
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/AbstractControllerTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/AbstractControllerTest.php
index ff719c210c..630a2cd24e 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/AbstractControllerTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/AbstractControllerTest.php
@@ -19,7 +19,9 @@
use Neos\Flow\Http\Response;
use Neos\Flow\Http\Uri;
use Neos\Flow\Mvc\Exception\ForwardException;
+use Neos\Flow\Mvc\Exception\RequiredArgumentMissingException;
use Neos\Flow\Mvc\Exception\StopActionException;
+use Neos\Flow\Mvc\Exception\UnsupportedRequestTypeException;
use Neos\Flow\Mvc\FlashMessageContainer;
use Neos\Flow\Mvc\Routing\UriBuilder;
use Neos\Flow\Persistence\PersistenceManagerInterface;
@@ -48,7 +50,7 @@ class AbstractControllerTest extends UnitTestCase
*/
protected $mockActionRequest;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpRequest->expects($this->any())->method('getNegotiatedMediaType')->will($this->returnValue('text/html'));
@@ -61,10 +63,10 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\UnsupportedRequestTypeException
*/
public function initializeControllerWillThrowAnExceptionIfTheGivenRequestIsNotSupported()
{
+ $this->expectException(UnsupportedRequestTypeException::class);
$request = new Cli\Request();
$response = new Cli\Response();
@@ -136,10 +138,10 @@ public function addFlashMessageTests($expectedMessage, $messageBody, $messageTit
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function addFlashMessageThrowsExceptionOnInvalidMessageBody()
{
+ $this->expectException(\InvalidArgumentException::class);
$flashMessageContainer = new FlashMessageContainer();
$controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']);
$this->inject($controller, 'flashMessageContainer', $flashMessageContainer);
@@ -316,10 +318,10 @@ public function redirectUsesRequestFormatAsDefaultAndUnsetsSubPackageKeyIfNecess
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\StopActionException
*/
public function redirectToUriThrowsStopActionException()
{
+ $this->expectException(StopActionException::class);
$controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']);
$controller->_call('initializeController', $this->mockActionRequest, $this->actionResponse);
@@ -381,10 +383,10 @@ public function redirectToUriDoesNotSetLocationHeaderIfDelayIsNotZero()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\StopActionException
*/
public function throwStatusSetsThrowsStopActionException()
{
+ $this->expectException(StopActionException::class);
$controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']);
$controller->_call('initializeController', $this->mockActionRequest, $this->actionResponse);
@@ -461,10 +463,10 @@ public function mapRequestArgumentsToControllerArgumentsDoesJustThat()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\RequiredArgumentMissingException
*/
public function mapRequestArgumentsToControllerArgumentsThrowsExceptionIfRequiredArgumentWasNotSet()
{
+ $this->expectException(RequiredArgumentMissingException::class);
$mockPropertyMapper = $this->getMockBuilder(PropertyMapper::class)->disableOriginalConstructor()->setMethods(['convert'])->getMock();
$mockPropertyMapper->expects($this->atLeastOnce())->method('convert')->will($this->returnArgument(0));
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/ActionControllerTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/ActionControllerTest.php
index fb53750d65..ae5646a58e 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/ActionControllerTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/ActionControllerTest.php
@@ -52,7 +52,7 @@ class ActionControllerTest extends UnitTestCase
*/
protected $mockControllerContext;
- public function setUp()
+ protected function setUp(): void
{
$this->actionController = $this->getAccessibleMock(ActionController::class, ['dummy']);
@@ -128,10 +128,10 @@ public function resolveViewReturnsDefaultViewIfNoViewObjectNameCouldBeResolved()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\NoSuchActionException
*/
public function processRequestThrowsExceptionIfRequestedActionIsNotCallable()
{
+ $this->expectException(Mvc\Exception\NoSuchActionException::class);
$this->actionController = new ActionController();
$this->inject($this->actionController, 'objectManager', $this->mockObjectManager);
@@ -153,10 +153,10 @@ public function processRequestThrowsExceptionIfRequestedActionIsNotCallable()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidActionVisibilityException
*/
public function processRequestThrowsExceptionIfRequestedActionIsNotPublic()
{
+ $this->expectException(Mvc\Exception\InvalidActionVisibilityException::class);
$this->actionController = new ActionController();
$this->inject($this->actionController, 'objectManager', $this->mockObjectManager);
@@ -252,10 +252,10 @@ public function processRequestInjectsSettingsToView()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\ViewNotFoundException
*/
public function resolveViewThrowsExceptionIfResolvedViewDoesNotImplementViewInterface()
{
+ $this->expectException(Mvc\Exception\ViewNotFoundException::class);
$this->mockObjectManager->expects($this->any())->method('getCaseSensitiveObjectName')->will($this->returnValue(false));
$this->actionController->_set('defaultViewObjectName', 'ViewDefaultObjectName');
$this->actionController->_call('resolveView');
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentTest.php
index fce4cf2668..a26888dcce 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentTest.php
@@ -39,7 +39,7 @@ class ArgumentTest extends UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
$this->simpleValueArgument = new Mvc\Controller\Argument('someName', 'string');
$this->objectArgument = new Mvc\Controller\Argument('someName', 'DateTime');
@@ -56,19 +56,19 @@ public function setUp()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructingArgumentWithoutNameThrowsException()
{
+ $this->expectException(\InvalidArgumentException::class);
new Mvc\Controller\Argument('', 'Text');
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructingArgumentWithInvalidNameThrowsException()
{
+ $this->expectException(\InvalidArgumentException::class);
new Mvc\Controller\Argument(new \ArrayObject(), 'Text');
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentsTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentsTest.php
index 776aff6068..281fbf4561 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentsTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/ArgumentsTest.php
@@ -149,10 +149,10 @@ public function addNewArgumentCanAddArgumentsMarkedAsOptionalWithDefaultValues()
/**
* @test
- * @expectedException \LogicException
*/
public function callingInvalidMethodThrowsException()
{
+ $this->expectException(\LogicException::class);
$arguments = new Arguments();
$arguments->nonExistingMethod();
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/CommandControllerTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/CommandControllerTest.php
index 1567a93085..c0a98f837b 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/CommandControllerTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/CommandControllerTest.php
@@ -45,7 +45,7 @@ class CommandControllerTest extends UnitTestCase
*/
protected $mockConsoleOutput;
- public function setUp()
+ protected function setUp(): void
{
$this->commandController = $this->getAccessibleMock(CommandController::class, ['resolveCommandMethodName', 'callCommandMethod']);
@@ -60,10 +60,10 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\UnsupportedRequestTypeException
*/
public function processRequestThrowsExceptionIfGivenRequestIsNoCliRequest()
{
+ $this->expectException(Mvc\Exception\UnsupportedRequestTypeException::class);
$mockRequest = $this->createMock(Mvc\RequestInterface::class);
$mockResponse = $this->createMock(Mvc\ResponseInterface::class);
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/FlashMessageContainerTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/FlashMessageContainerTest.php
index ce76f9260f..17d233eaa9 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/FlashMessageContainerTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/FlashMessageContainerTest.php
@@ -25,7 +25,7 @@ class FlashMessageContainerTest extends UnitTestCase
*/
protected $flashMessageContainer;
- public function setUp()
+ protected function setUp(): void
{
$this->flashMessageContainer = new Mvc\FlashMessageContainer();
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php
index c2b979fd15..dca252ea33 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationServiceTest.php
@@ -14,6 +14,7 @@
use Neos\Flow\Property\PropertyMappingConfiguration;
use Neos\Flow\Property\TypeConverter\PersistentObjectConverter;
use Neos\Flow\Security\Cryptography\HashService;
+use Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Mvc;
@@ -123,10 +124,10 @@ public function generateTrustedPropertiesTokenGeneratesTheCorrectHashesInNormalO
/**
* @test
* @dataProvider dataProviderForgenerateTrustedPropertiesTokenWithUnallowedValues
- * @expectedException \Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException
*/
public function generateTrustedPropertiesTokenThrowsExceptionInWrongCases($input)
{
+ $this->expectException(InvalidArgumentForHashGenerationException::class);
$requestHashService = $this->getMockBuilder(Mvc\Controller\MvcPropertyMappingConfigurationService::class)->setMethods(['serializeAndHashFormFieldArray'])->getMock();
$requestHashService->generateTrustedPropertiesToken($input);
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationTest.php b/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationTest.php
index 52037b18f4..8806ca140f 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Controller/MvcPropertyMappingConfigurationTest.php
@@ -27,7 +27,7 @@ class MvcPropertyMappingConfigurationTest extends UnitTestCase
/**
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mvcPropertyMappingConfiguration = new MvcPropertyMappingConfiguration();
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/DispatchComponentTest.php b/Neos.Flow/Tests/Unit/Mvc/DispatchComponentTest.php
index f46e8cfb51..b4199b03a4 100644
--- a/Neos.Flow/Tests/Unit/Mvc/DispatchComponentTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/DispatchComponentTest.php
@@ -79,7 +79,7 @@ class DispatchComponentTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->dispatchComponent = new DispatchComponent();
diff --git a/Neos.Flow/Tests/Unit/Mvc/DispatcherTest.php b/Neos.Flow/Tests/Unit/Mvc/DispatcherTest.php
index aebf34eea6..b297f57f86 100644
--- a/Neos.Flow/Tests/Unit/Mvc/DispatcherTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/DispatcherTest.php
@@ -17,8 +17,10 @@
use Neos\Flow\Log\PsrLoggerFactoryInterface;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\Controller\ControllerInterface;
+use Neos\Flow\Mvc\Controller\Exception\InvalidControllerException;
use Neos\Flow\Mvc\Dispatcher;
use Neos\Flow\Mvc\Exception\ForwardException;
+use Neos\Flow\Mvc\Exception\InfiniteLoopException;
use Neos\Flow\Mvc\Exception\StopActionException;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Security\Authentication\EntryPointInterface;
@@ -93,7 +95,7 @@ class DispatcherTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->dispatcher = $this->getMockBuilder(Dispatcher::class)->disableOriginalConstructor()->setMethods(['resolveController'])->getMock();
@@ -199,10 +201,10 @@ public function dispatchContinuesWithNextRequestFoundInAForwardException()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InfiniteLoopException
*/
public function dispatchThrowsAnInfiniteLoopExceptionIfTheRequestCouldNotBeDispachedAfter99Iterations()
{
+ $this->expectException(InfiniteLoopException::class);
$requestCallCounter = 0;
$requestCallBack = function () use (&$requestCallCounter) {
return ($requestCallCounter++ < 101) ? false : true;
@@ -254,10 +256,10 @@ public function dispatchInterceptsActionRequestsByDefault()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\AuthenticationRequiredException
*/
public function dispatchRethrowsAuthenticationRequiredExceptionIfSecurityContextDoesNotContainAnyAuthenticationToken()
{
+ $this->expectException(AuthenticationRequiredException::class);
$this->mockActionRequest->expects($this->any())->method('isDispatched')->will($this->returnValue(true));
$this->mockSecurityContext->expects($this->atLeastOnce())->method('getAuthenticationTokens')->will($this->returnValue([]));
@@ -341,10 +343,10 @@ public function dispatchCallsStartAuthenticationOnAllActiveEntryPoints()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\AccessDeniedException
*/
public function dispatchRethrowsAccessDeniedException()
{
+ $this->expectException(AccessDeniedException::class);
$this->mockActionRequest->expects($this->any())->method('isDispatched')->will($this->returnValue(true));
$this->mockFirewall->expects($this->once())->method('blockIllegalRequests')->will($this->throwException(new AccessDeniedException()));
@@ -375,10 +377,10 @@ public function resolveControllerReturnsTheControllerSpecifiedInTheRequest()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Controller\Exception\InvalidControllerException
*/
public function resolveControllerThrowsAnInvalidControllerExceptionIfTheResolvedControllerDoesNotImplementTheControllerInterface()
{
+ $this->expectException(InvalidControllerException::class);
$mockController = $this->createMock('stdClass');
/** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $mockObjectManager */
@@ -397,10 +399,10 @@ public function resolveControllerThrowsAnInvalidControllerExceptionIfTheResolved
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Controller\Exception\InvalidControllerException
*/
public function resolveControllerThrowsAnInvalidControllerExceptionIfTheResolvedControllerDoesNotExist()
{
+ $this->expectException(InvalidControllerException::class);
$mockHttpRequest = $this->getMockBuilder(HttpRequest::class)->disableOriginalConstructor()->getMock();
$mockRequest = $this->getMockBuilder(ActionRequest::class)->disableOriginalConstructor()->setMethods(['getControllerObjectName', 'getHttpRequest'])->getMock();
$mockRequest->expects($this->any())->method('getControllerObjectName')->will($this->returnValue(''));
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteContextTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteContextTest.php
index 87a8289c04..b782cb76be 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteContextTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteContextTest.php
@@ -42,7 +42,7 @@ class RouteContextTest extends UnitTestCase
*/
private $mockUri2;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest1 = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteParametersTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteParametersTest.php
index c54a38566a..cda29d7160 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteParametersTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteParametersTest.php
@@ -33,10 +33,10 @@ public function withParameterThrowsExceptionForInvalidParameterValuesDataProvide
/**
* @test
* @dataProvider withParameterThrowsExceptionForInvalidParameterValuesDataProvider
- * @expectedException \InvalidArgumentException
*/
public function withParameterThrowsExceptionForInvalidParameterValues($parameterValue)
{
+ $this->expectException(\InvalidArgumentException::class);
RouteParameters::createEmpty()->withParameter('someParameter', $parameterValue);
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteTagsTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteTagsTest.php
index 1fcb04e3f3..09874c7b81 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteTagsTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/Dto/RouteTagsTest.php
@@ -30,11 +30,11 @@ public function createFromTagThrowsExceptionForInvalidTagsDataProvider()
/**
* @test
- * @expectedException \InvalidArgumentException
* @dataProvider createFromTagThrowsExceptionForInvalidTagsDataProvider
*/
public function createFromTagThrowsExceptionForInvalidTags($tag)
{
+ $this->expectException(\InvalidArgumentException::class);
RouteTags::createFromTag($tag);
}
@@ -58,19 +58,19 @@ public function createFromArrayCreatesAnInstanceWithAllGivenTags()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function createFromArrayDoesNotAcceptIntegerValues()
{
+ $this->expectException(\InvalidArgumentException::class);
RouteTags::createFromArray([123]);
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function createFromArrayDoesNotAcceptObjectValues()
{
+ $this->expectException(\InvalidArgumentException::class);
RouteTags::createFromArray([new \stdClass()]);
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/DynamicRoutePartTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/DynamicRoutePartTest.php
index ce30cc80a3..c5ab3536af 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/DynamicRoutePartTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/DynamicRoutePartTest.php
@@ -31,7 +31,7 @@ class DynamicRoutePartTest extends UnitTestCase
*/
protected $mockPersistenceManager;
- public function setUp()
+ protected function setUp(): void
{
$this->dynamicRoutPart = $this->getAccessibleMock(DynamicRoutePart::class, ['dummy']);
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/IdentityRoutePartTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/IdentityRoutePartTest.php
index b700c747c4..ec340933af 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/IdentityRoutePartTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/IdentityRoutePartTest.php
@@ -10,6 +10,9 @@
* information, please view the LICENSE file which was distributed with this
* source code.
*/
+
+use Neos\Flow\Mvc\Exception\InfiniteLoopException;
+use Neos\Flow\Mvc\Exception\InvalidUriPatternException;
use Neos\Flow\Mvc\Routing\IdentityRoutePart;
use Neos\Flow\Mvc\Routing\ObjectPathMapping;
use Neos\Flow\Mvc\Routing\ObjectPathMappingRepository;
@@ -51,7 +54,7 @@ class IdentityRoutePartTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->identityRoutePart = $this->getAccessibleMock(IdentityRoutePart::class, ['createPathSegmentForObject']);
@@ -470,10 +473,10 @@ public function resolveValueAppendsCounterIfCreatedPathSegmentIsEmpty()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InfiniteLoopException
*/
public function resolveValueThrowsInfiniteLoopExceptionIfNoUniquePathSegmentCantBeFound()
{
+ $this->expectException(InfiniteLoopException::class);
$object = new \stdClass();
$this->mockPersistenceManager->expects($this->atLeastOnce())->method('getIdentifierByObject')->with($object)->will($this->returnValue('TheIdentifier'));
$this->mockPersistenceManager->expects($this->atLeastOnce())->method('getObjectByIdentifier')->with('TheIdentifier')->will($this->returnValue($object));
@@ -538,10 +541,10 @@ public function createPathSegmentForObjectTests($object, $uriPattern, $expectedR
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function createPathSegmentForObjectThrowsInvalidUriPatterExceptionIfItSpecifiedPropertiesContainObjects()
{
+ $this->expectException(InvalidUriPatternException::class);
$identityRoutePart = $this->getAccessibleMock(IdentityRoutePart::class, ['dummy']);
$object = new \stdClass();
$object->objectProperty = new \stdClass();
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/RouteTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/RouteTest.php
index 2bbbf7191d..5990f3a0c0 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/RouteTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/RouteTest.php
@@ -13,7 +13,10 @@
use Neos\Flow\Http;
use Neos\Flow\Http\Request;
+use Neos\Flow\Mvc\Exception\InvalidRoutePartHandlerException;
use Neos\Flow\Mvc\Exception\InvalidRoutePartValueException;
+use Neos\Flow\Mvc\Exception\InvalidRouteSetupException;
+use Neos\Flow\Mvc\Exception\InvalidUriPatternException;
use Neos\Flow\Mvc\Routing\Dto\RouteParameters;
use Neos\Flow\Mvc\Routing\Dto\RouteContext;
use Neos\Flow\Mvc\Routing\Fixtures\MockRoutePartHandler;
@@ -54,7 +57,7 @@ class RouteTest extends UnitTestCase
* Sets up this test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$this->route = $this->getAccessibleMock(Routing\Route::class, ['dummy']);
@@ -144,10 +147,10 @@ public function routePartHandlerIsInstantiated()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidRoutePartHandlerException
*/
public function settingInvalidRoutePartHandlerThrowsException()
{
+ $this->expectException(InvalidRoutePartHandlerException::class);
$this->route->setUriPattern('{key1}/{key2}');
$this->route->setRoutePartsConfiguration(
[
@@ -204,60 +207,60 @@ public function parseSetsUriPatternOfIdentityRoutePartIfSpecified()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function uriPatternWithTrailingSlashThrowsException()
{
+ $this->expectException(InvalidUriPatternException::class);
$this->route->setUriPattern('some/uri/pattern/');
$this->route->parse();
}
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function uriPatternWithLeadingSlashThrowsException()
{
+ $this->expectException(InvalidUriPatternException::class);
$this->route->setUriPattern('/some/uri/pattern');
$this->route->parse();
}
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function uriPatternWithSuccessiveDynamicRoutepartsThrowsException()
{
+ $this->expectException(InvalidUriPatternException::class);
$this->route->setUriPattern('{key1}{key2}');
$this->route->parse();
}
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function uriPatternWithSuccessiveOptionalSectionsThrowsException()
{
+ $this->expectException(InvalidUriPatternException::class);
$this->route->setUriPattern('(foo/bar)(/bar/foo)');
$this->route->parse();
}
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function uriPatternWithUnterminatedOptionalSectionsThrowsException()
{
+ $this->expectException(InvalidUriPatternException::class);
$this->route->setUriPattern('foo/(bar');
$this->route->parse();
}
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidUriPatternException
*/
public function uriPatternWithUnopenedOptionalSectionsThrowsException()
{
+ $this->expectException(InvalidUriPatternException::class);
$this->route->setUriPattern('foo)/bar');
$this->route->parse();
}
@@ -567,10 +570,10 @@ public function routeMatchesRequestPathWithAllPartsIfUriPatternContainsTwoOption
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidRouteSetupException
*/
public function routeThrowsExceptionIfUriPatternContainsOneOptionalDynamicRoutePartWithoutDefaultValue()
{
+ $this->expectException(InvalidRouteSetupException::class);
$this->route->setUriPattern('({optional})');
$this->assertFalse($this->routeMatchesPath(''));
@@ -1053,10 +1056,10 @@ public function resolvesReturnsTrueIfTargetControllerExists()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidRoutePartValueException
*/
public function resolvesThrowsExceptionIfRoutePartValueIsNoString()
{
+ $this->expectException(InvalidRoutePartValueException::class);
$mockRoutePart = $this->createMock(Routing\RoutePartInterface::class);
$mockRoutePart->expects($this->any())->method('resolve')->will($this->returnValue(true));
$mockRoutePart->expects($this->any())->method('hasValue')->will($this->returnValue(true));
@@ -1070,10 +1073,10 @@ public function resolvesThrowsExceptionIfRoutePartValueIsNoString()
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidRoutePartValueException
*/
public function resolvesThrowsExceptionIfRoutePartDefaultValueIsNoString()
{
+ $this->expectException(InvalidRoutePartValueException::class);
$mockRoutePart = $this->createMock(Routing\RoutePartInterface::class);
$mockRoutePart->expects($this->any())->method('resolve')->will($this->returnValue(true));
$mockRoutePart->expects($this->any())->method('hasValue')->will($this->returnValue(false));
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/RouterCachingServiceTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/RouterCachingServiceTest.php
index e5e611ef73..084441c5b8 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/RouterCachingServiceTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/RouterCachingServiceTest.php
@@ -81,7 +81,7 @@ class RouterCachingServiceTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->routerCachingService = $this->getAccessibleMock(RouterCachingService::class, ['dummy']);
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/RouterTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/RouterTest.php
index b03c10626e..995866156d 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/RouterTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/RouterTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Configuration\ConfigurationManager;
use Neos\Flow\Http\Request;
+use Neos\Flow\Mvc\Exception\InvalidRouteSetupException;
use Neos\Flow\Mvc\Exception\NoMatchingRouteException;
use Neos\Flow\Mvc\Routing\Dto\RouteParameters;
use Neos\Flow\Mvc\Routing\Dto\ResolveContext;
@@ -65,7 +66,7 @@ class RouterTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->router = $this->getAccessibleMock(Router::class, ['dummy']);
@@ -150,10 +151,10 @@ public function createRoutesFromConfigurationParsesTheGivenConfigurationAndBuild
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\InvalidRouteSetupException
*/
public function createRoutesFromConfigurationThrowsExceptionIfOnlySomeRoutesWithTheSameUriPatternHaveHttpMethodConstraints()
{
+ $this->expectException(InvalidRouteSetupException::class);
$routesConfiguration = [
[
'uriPattern' => 'somePattern'
@@ -200,10 +201,10 @@ public function resolveIteratesOverTheRegisteredRoutesAndReturnsTheResolvedUriCo
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Exception\NoMatchingRouteException
*/
public function resolveThrowsExceptionIfNoMatchingRouteWasFound()
{
+ $this->expectException(NoMatchingRouteException::class);
/** @var Router|\PHPUnit_Framework_MockObject_MockObject $router */
$router = $this->getAccessibleMock(Router::class, ['createRoutesFromConfiguration']);
$this->inject($router, 'routerCachingService', $this->mockRouterCachingService);
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/RoutingComponentTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/RoutingComponentTest.php
index 9c073a715e..3b3c6006ad 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/RoutingComponentTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/RoutingComponentTest.php
@@ -60,7 +60,7 @@ class RoutingComponentTest extends UnitTestCase
* Sets up this test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->routingComponent = new RoutingComponent([]);
diff --git a/Neos.Flow/Tests/Unit/Mvc/Routing/UriBuilderTest.php b/Neos.Flow/Tests/Unit/Mvc/Routing/UriBuilderTest.php
index 9061fd0bf1..f1a27bd7a3 100644
--- a/Neos.Flow/Tests/Unit/Mvc/Routing/UriBuilderTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/Routing/UriBuilderTest.php
@@ -63,7 +63,7 @@ class UriBuilderTest extends UnitTestCase
* Sets up the test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockHttpRequest = $this->getMockBuilder(Http\Request::class)->disableOriginalConstructor()->getMock();
@@ -139,10 +139,10 @@ public function uriForRecursivelyMergesAndOverrulesControllerArgumentsWithArgume
/**
* @test
- * @expectedException \Neos\Flow\Mvc\Routing\Exception\MissingActionNameException
*/
public function uriForThrowsExceptionIfActionNameIsNotSpecified()
{
+ $this->expectException(Mvc\Routing\Exception\MissingActionNameException::class);
$this->uriBuilder->uriFor(null, [], 'SomeController', 'SomePackage');
}
diff --git a/Neos.Flow/Tests/Unit/Mvc/View/JsonViewTest.php b/Neos.Flow/Tests/Unit/Mvc/View/JsonViewTest.php
index aeb65f342d..4745908cb4 100644
--- a/Neos.Flow/Tests/Unit/Mvc/View/JsonViewTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/View/JsonViewTest.php
@@ -40,7 +40,7 @@ class JsonViewTest extends UnitTestCase
* Sets up this test case
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->view = $this->getMockBuilder(Mvc\View\JsonView::class)->setMethods(['loadConfigurationFromYamlFile'])->getMock();
$this->controllerContext = $this->getMockBuilder(Mvc\Controller\ControllerContext::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Mvc/ViewConfigurationManagerTest.php b/Neos.Flow/Tests/Unit/Mvc/ViewConfigurationManagerTest.php
index e67f2ad4a9..fd64b8dc5b 100644
--- a/Neos.Flow/Tests/Unit/Mvc/ViewConfigurationManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Mvc/ViewConfigurationManagerTest.php
@@ -46,7 +46,7 @@ class ViewConfigurationManagerTest extends \Neos\Flow\Tests\UnitTestCase
protected $mockCache;
- public function setUp()
+ protected function setUp(): void
{
$this->viewConfigurationManager = new ViewConfigurationManager();
diff --git a/Neos.Flow/Tests/Unit/ObjectManagement/CompileTimeObjectManagerTest.php b/Neos.Flow/Tests/Unit/ObjectManagement/CompileTimeObjectManagerTest.php
index 5a02ff4f92..7488c5911c 100644
--- a/Neos.Flow/Tests/Unit/ObjectManagement/CompileTimeObjectManagerTest.php
+++ b/Neos.Flow/Tests/Unit/ObjectManagement/CompileTimeObjectManagerTest.php
@@ -30,7 +30,7 @@ class CompileTimeObjectManagerTest extends UnitTestCase
*/
protected $compileTimeObjectManager;
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Packages');
$this->mockPackageManager = $this->getMockBuilder(PackageManager::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationBuilderTest.php b/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationBuilderTest.php
index 2d3626b95d..6593f348a0 100644
--- a/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationBuilderTest.php
+++ b/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationBuilderTest.php
@@ -16,6 +16,8 @@
use Neos\Flow\ObjectManagement\Configuration\ConfigurationArgument;
use Neos\Flow\ObjectManagement\Configuration\ConfigurationBuilder;
use Neos\Flow\ObjectManagement\Configuration\ConfigurationProperty;
+use Neos\Flow\ObjectManagement\Exception;
+use Neos\Flow\ObjectManagement\Exception\InvalidObjectConfigurationException;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Annotations as Flow;
@@ -117,10 +119,10 @@ public function itIsPossibleToPassArraysAsStraightArgumentOrPropertyValues()
/**
* @test
- * @expectedException \Neos\Flow\ObjectManagement\Exception\InvalidObjectConfigurationException
*/
public function invalidOptionResultsInException()
{
+ $this->expectException(InvalidObjectConfigurationException::class);
$configurationArray = ['scoopy' => 'prototype'];
$configurationBuilder = $this->getAccessibleMock(ConfigurationBuilder::class, ['dummy']);
$configurationBuilder->_call('parseConfigurationArray', 'TestObject', $configurationArray, __CLASS__);
@@ -128,10 +130,10 @@ public function invalidOptionResultsInException()
/**
* @test
- * @expectedException \Neos\Flow\ObjectManagement\Exception
*/
public function privatePropertyAnnotatedForInjectionThrowsException()
{
+ $this->expectException(Exception::class);
$configurationArray = [];
$configurationArray['arguments'][1]['setting'] = 'Neos.Foo.Bar';
$configurationArray['properties']['someProperty']['setting'] = 'Neos.Bar.Baz';
@@ -158,10 +160,10 @@ public function privatePropertyAnnotatedForInjectionThrowsException()
/**
* @test
- * @expectedException \Neos\Flow\ObjectManagement\Exception\UnknownClassException
*/
public function errorOnGetClassMethodsThrowsException()
{
+ $this->expectException(Exception\UnknownClassException::class);
$configurationArray = [];
$configurationArray['properties']['someProperty']['object']['name'] = 'Foo';
$configurationArray['properties']['someProperty']['object']['className'] = 'foobar';
diff --git a/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationTest.php b/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationTest.php
index 792343d10e..2f97ff1890 100644
--- a/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationTest.php
+++ b/Neos.Flow/Tests/Unit/ObjectManagement/Configuration/ConfigurationTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Configuration\Exception\InvalidConfigurationException;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\ObjectManagement\Configuration;
@@ -28,7 +29,7 @@ class ConfigurationTest extends UnitTestCase
* Prepares everything for a test
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->objectConfiguration = new Configuration\Configuration('Neos\Foo\Bar');
}
@@ -37,10 +38,10 @@ public function setUp()
* Checks if setProperties accepts only valid values
*
* @test
- * @expectedException \Neos\Flow\Configuration\Exception\InvalidConfigurationException
*/
public function setPropertiesOnlyAcceptsValidValues()
{
+ $this->expectException(InvalidConfigurationException::class);
$invalidProperties = [
'validProperty' => new Configuration\ConfigurationProperty('validProperty', 'simple string'),
'invalidProperty' => 'foo'
@@ -69,10 +70,10 @@ public function passingAnEmptyArrayToSetPropertiesRemovesAllExistingproperties()
* Checks if setArguments accepts only valid values
*
* @test
- * @expectedException \Neos\Flow\Configuration\Exception\InvalidConfigurationException
*/
public function setArgumentsOnlyAcceptsValidValues()
{
+ $this->expectException(InvalidConfigurationException::class);
$invalidArguments = [
1 => new Configuration\ConfigurationArgument(1, 'simple string'),
2 => 'foo'
@@ -117,10 +118,10 @@ public function setFactoryMethodNameAcceptsValidStrings()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setFactoryMethodNameRejectsAnythingElseThanAString()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->objectConfiguration->setFactoryMethodName([]);
}
diff --git a/Neos.Flow/Tests/Unit/ObjectManagement/Proxy/CompilerTest.php b/Neos.Flow/Tests/Unit/ObjectManagement/Proxy/CompilerTest.php
index 3ff90ffd46..50114b3f88 100644
--- a/Neos.Flow/Tests/Unit/ObjectManagement/Proxy/CompilerTest.php
+++ b/Neos.Flow/Tests/Unit/ObjectManagement/Proxy/CompilerTest.php
@@ -31,7 +31,7 @@ class CompilerTest extends UnitTestCase
*/
protected $compiler;
- protected function setUp()
+ protected function setUp(): void
{
$this->compiler = $this->getAccessibleMock(Compiler::class, null);
}
diff --git a/Neos.Flow/Tests/Unit/Package/PackageFactoryTest.php b/Neos.Flow/Tests/Unit/Package/PackageFactoryTest.php
index b1fb6f1133..b9f7427f2c 100644
--- a/Neos.Flow/Tests/Unit/Package/PackageFactoryTest.php
+++ b/Neos.Flow/Tests/Unit/Package/PackageFactoryTest.php
@@ -11,6 +11,8 @@
* source code.
*/
+use Neos\Flow\Package\Exception\CorruptPackageException;
+use Neos\Flow\Package\Exception\InvalidPackagePathException;
use org\bovigo\vfs\vfsStream;
use Neos\Flow\Composer\ComposerUtility;
use Neos\Flow\Package\Package;
@@ -36,7 +38,7 @@ class PackageFactoryTest extends UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
ComposerUtility::flushCaches();
vfsStream::setup('Packages');
@@ -48,19 +50,19 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Flow\Package\Exception\InvalidPackagePathException
*/
public function createThrowsExceptionWhenSpecifyingANonExistingPackagePath()
{
+ $this->expectException(InvalidPackagePathException::class);
$this->packageFactory->create('vfs://Packages/', 'Some/Non/Existing/Path/Some.Package/', 'Some.Package', 'some/package');
}
/**
* @test
- * @expectedException \Neos\Flow\Package\Exception\CorruptPackageException
*/
public function createThrowsExceptionIfCustomPackageFileCantBeAnalyzed()
{
+ $this->expectException(CorruptPackageException::class);
$packagePath = 'vfs://Packages/Some/Path/Some.Package/';
$packageFilePath = $packagePath . 'Classes/Some/Package/Package.php';
mkdir(dirname($packageFilePath), 0777, true);
@@ -72,10 +74,10 @@ public function createThrowsExceptionIfCustomPackageFileCantBeAnalyzed()
/**
* @test
- * @expectedException \Neos\Flow\Package\Exception\CorruptPackageException
*/
public function createThrowsExceptionIfCustomPackageDoesNotImplementPackageInterface()
{
+ $this->expectException(CorruptPackageException::class);
$packagePath = 'vfs://Packages/Some/Path/Some.Package/';
$packageFilePath = $packagePath . 'Classes/Some/Package/Package.php';
mkdir(dirname($packageFilePath), 0777, true);
diff --git a/Neos.Flow/Tests/Unit/Package/PackageManagerTest.php b/Neos.Flow/Tests/Unit/Package/PackageManagerTest.php
index a9dd8eb0c6..81ba23e839 100644
--- a/Neos.Flow/Tests/Unit/Package/PackageManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Package/PackageManagerTest.php
@@ -16,6 +16,8 @@
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Package\Exception\InvalidPackageKeyException;
+use Neos\Flow\Package\Exception\PackageKeyAlreadyExistsException;
+use Neos\Flow\Package\Exception\UnknownPackageException;
use Neos\Flow\Package\FlowPackageInterface;
use Neos\Flow\Package\PackageFactory;
use Neos\Flow\Package\PackageInterface;
@@ -56,7 +58,7 @@ class PackageManagerTest extends UnitTestCase
* Sets up this test case
*
*/
- protected function setUp()
+ protected function setUp(): void
{
ComposerUtility::flushCaches();
vfsStream::setup('Test');
@@ -101,10 +103,10 @@ public function getPackageReturnsTheSpecifiedPackage()
/**
* @test
- * @expectedException \Neos\Flow\Package\Exception\UnknownPackageException
*/
public function getPackageThrowsExceptionOnUnknownPackage()
{
+ $this->expectException(UnknownPackageException::class);
$this->packageManager->getPackage('PrettyUnlikelyThatThisPackageExists');
}
@@ -343,10 +345,10 @@ public function createPackageThrowsExceptionOnInvalidPackageKey()
* Makes sure that duplicate package keys are detected.
*
* @test
- * @expectedException \Neos\Flow\Package\Exception\PackageKeyAlreadyExistsException
*/
public function createPackageThrowsExceptionForExistingPackageKey()
{
+ $this->expectException(PackageKeyAlreadyExistsException::class);
$this->packageManager->createPackage('Acme.YetAnotherTestPackage', [], 'vfs://Test/Packages/Application');
$this->packageManager->createPackage('Acme.YetAnotherTestPackage', [], 'vfs://Test/Packages/Application');
}
@@ -400,10 +402,10 @@ public function getPackageKeyFromComposerNameIgnoresCaseDifferences($composerNam
/**
* @test
- * @expectedException \Neos\Flow\Package\Exception\PackageKeyAlreadyExistsException
*/
public function registeringTheSamePackageKeyWithDifferentCaseShouldThrowException()
{
+ $this->expectException(PackageKeyAlreadyExistsException::class);
$this->packageManager->createPackage('doctrine.instantiator', [], 'vfs://Test/Packages/Application');
$this->packageManager->createPackage('doctrine.Instantiator', [], 'vfs://Test/Packages/Application');
}
diff --git a/Neos.Flow/Tests/Unit/Package/PackageTest.php b/Neos.Flow/Tests/Unit/Package/PackageTest.php
index efe310717f..24b71e11be 100644
--- a/Neos.Flow/Tests/Unit/Package/PackageTest.php
+++ b/Neos.Flow/Tests/Unit/Package/PackageTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Composer\ComposerUtility;
+use Neos\Flow\Composer\Exception\MissingPackageManifestException;
use Neos\Flow\Package\Package;
use org\bovigo\vfs\vfsStream;
use Neos\Flow\Package\PackageManager;
@@ -31,7 +32,7 @@ class PackageTest extends UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
ComposerUtility::flushCaches();
vfsStream::setup('Packages');
@@ -87,10 +88,10 @@ public function packageManifestContainsPackageType()
/**
* @test
- * @expectedException \Neos\Flow\Composer\Exception\MissingPackageManifestException
*/
public function throwExceptionWhenSpecifyingAPathWithMissingComposerManifest()
{
+ $this->expectException(MissingPackageManifestException::class);
$packagePath = 'vfs://Packages/Some/Path/Some.Package/';
mkdir($packagePath, 0777, true);
$package = new Package('Some.Package', 'some/package', 'vfs://Packages/Some/Path/Some.Package/', []);
diff --git a/Neos.Flow/Tests/Unit/Persistence/AbstractPersistenceManagerTest.php b/Neos.Flow/Tests/Unit/Persistence/AbstractPersistenceManagerTest.php
index c8716d818b..843f0dade7 100644
--- a/Neos.Flow/Tests/Unit/Persistence/AbstractPersistenceManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/AbstractPersistenceManagerTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Persistence\AbstractPersistenceManager;
+use Neos\Flow\Persistence\Exception\UnknownObjectException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -24,7 +25,7 @@ class AbstractPersistenceManagerTest extends UnitTestCase
*/
protected $abstractPersistenceManager;
- public function setUp()
+ protected function setUp(): void
{
$this->abstractPersistenceManager = $this->getMockBuilder(AbstractPersistenceManager::class)->setMethods(['initialize', 'persistAll', 'isNewObject', 'getObjectByIdentifier', 'createQueryForType', 'add', 'remove', 'update', 'getIdentifierByObject', 'clearState', 'isConnected'])->getMock();
}
@@ -44,10 +45,10 @@ public function convertObjectToIdentityArrayConvertsAnObject()
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\UnknownObjectException
*/
public function convertObjectToIdentityArrayThrowsExceptionIfIdentityForTheGivenObjectCantBeDetermined()
{
+ $this->expectException(UnknownObjectException::class);
$someObject = new \stdClass();
$this->abstractPersistenceManager->expects($this->once())->method('getIdentifierByObject')->with($someObject)->will($this->returnValue(null));
diff --git a/Neos.Flow/Tests/Unit/Persistence/Aspect/PersistenceMagicAspectTest.php b/Neos.Flow/Tests/Unit/Persistence/Aspect/PersistenceMagicAspectTest.php
index 6ef60eb6d8..f8d4fd4147 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Aspect/PersistenceMagicAspectTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Aspect/PersistenceMagicAspectTest.php
@@ -39,7 +39,7 @@ class PersistenceMagicAspectTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->persistenceMagicAspect = $this->getAccessibleMock(PersistenceMagicAspect::class, ['dummy'], []);
diff --git a/Neos.Flow/Tests/Unit/Persistence/Doctrine/DataTypes/JsonArrayTypeTest.php b/Neos.Flow/Tests/Unit/Persistence/Doctrine/DataTypes/JsonArrayTypeTest.php
index 1afa9c8c3f..3faa580d20 100755
--- a/Neos.Flow/Tests/Unit/Persistence/Doctrine/DataTypes/JsonArrayTypeTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Doctrine/DataTypes/JsonArrayTypeTest.php
@@ -29,7 +29,7 @@ class JsonArrayTypeTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->jsonArrayTypeMock = $this->getMockBuilder(JsonArrayType::class)
->setMethods(['initializeDependencies'])
diff --git a/Neos.Flow/Tests/Unit/Persistence/Doctrine/PersistenceManagerTest.php b/Neos.Flow/Tests/Unit/Persistence/Doctrine/PersistenceManagerTest.php
index 51ad94a62e..f39d6daccb 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Doctrine/PersistenceManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Doctrine/PersistenceManagerTest.php
@@ -12,11 +12,13 @@
*/
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception\ConnectionException;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\UnitOfWork;
use Neos\Flow\Log\ThrowableStorageInterface;
use Neos\Flow\Persistence\Doctrine\PersistenceManager;
+use Neos\Flow\Persistence\Exception;
use Neos\Flow\Tests\UnitTestCase;
use Psr\Log\LoggerInterface;
@@ -55,7 +57,7 @@ class PersistenceManagerTest extends UnitTestCase
*/
protected $mockPing;
- public function setUp()
+ protected function setUp(): void
{
$this->persistenceManager = $this->getMockBuilder(\Neos\Flow\Persistence\Doctrine\PersistenceManager::class)->setMethods(['emitAllObjectsPersisted'])->getMock();
@@ -94,11 +96,11 @@ public function getIdentifierByObjectUsesUnitOfWorkIdentityWithEmptyFlowPersiste
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception
- * @expectedExceptionMessageRegExp /^Detected modified or new objects/
*/
public function persistAllThrowsExceptionIfTryingToPersistNonWhitelistedObjectsAndOnlyWhitelistedObjectsFlagIsTrue()
{
+ $this->expectException(Exception::class);
+ $this->expectExceptionMessageRegExp('/^Detected modified or new objects/');
$mockObject = new \stdClass();
$scheduledEntityUpdates = [spl_object_hash($mockObject) => $mockObject];
$scheduledEntityDeletes = [];
@@ -171,10 +173,10 @@ public function persistAllReconnectsConnectionWhenConnectionLost()
/**
* @test
- * @expectedException \Doctrine\DBAL\DBALException
*/
public function persistAllThrowsOriginalExceptionWhenEntityManagerGotClosed()
{
+ $this->expectException(DBALException::class);
$this->mockEntityManager->expects($this->exactly(1))->method('flush')->willThrowException(new \Doctrine\DBAL\DBALException('Dummy error that closed the entity manager'));
$this->mockConnection->expects($this->never())->method('close');
diff --git a/Neos.Flow/Tests/Unit/Persistence/Doctrine/QueryResultTest.php b/Neos.Flow/Tests/Unit/Persistence/Doctrine/QueryResultTest.php
index 84195775bb..09d510438d 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Doctrine/QueryResultTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Doctrine/QueryResultTest.php
@@ -35,7 +35,7 @@ class QueryResultTest extends UnitTestCase
* Sets up this test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->query = $this->getMockBuilder(Query::class)->disableOriginalConstructor()->disableOriginalClone()->getMock();
$this->query->expects($this->any())->method('getResult')->will($this->returnValue(['First result', 'second result', 'third result']));
diff --git a/Neos.Flow/Tests/Unit/Persistence/Doctrine/RepositoryTest.php b/Neos.Flow/Tests/Unit/Persistence/Doctrine/RepositoryTest.php
index a6a017da50..8715773588 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Doctrine/RepositoryTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Doctrine/RepositoryTest.php
@@ -34,7 +34,7 @@ class RepositoryTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockEntityManager = $this->getMockBuilder(EntityManagerInterface::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Persistence/Generic/DataMapperTest.php b/Neos.Flow/Tests/Unit/Persistence/Generic/DataMapperTest.php
index 55d718b304..7343aef565 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Generic/DataMapperTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Generic/DataMapperTest.php
@@ -24,10 +24,10 @@ class DataMapperTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Generic\Exception\InvalidObjectDataException
*/
public function mapToObjectThrowsExceptionOnEmptyInput()
{
+ $this->expectException(Persistence\Generic\Exception\InvalidObjectDataException::class);
$objectData = [];
$dataMapper = $this->getAccessibleMock(Persistence\Generic\DataMapper::class, ['dummy']);
diff --git a/Neos.Flow/Tests/Unit/Persistence/Generic/QueryResultTest.php b/Neos.Flow/Tests/Unit/Persistence/Generic/QueryResultTest.php
index a7771ce361..1ae3365b47 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Generic/QueryResultTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Generic/QueryResultTest.php
@@ -52,7 +52,7 @@ class QueryResultTest extends UnitTestCase
* Sets up this test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->persistenceManager = $this->getMockBuilder(PersistenceManager::class)->disableOriginalConstructor()->getMock();
$this->persistenceManager->expects($this->any())->method('getObjectDataByQuery')->will($this->returnValue(['one', 'two']));
diff --git a/Neos.Flow/Tests/Unit/Persistence/Generic/QueryTest.php b/Neos.Flow/Tests/Unit/Persistence/Generic/QueryTest.php
index f4a6949892..a394ea6277 100644
--- a/Neos.Flow/Tests/Unit/Persistence/Generic/QueryTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/Generic/QueryTest.php
@@ -40,7 +40,7 @@ class QueryTest extends UnitTestCase
* Sets up this test case
*
*/
- public function setUp()
+ protected function setUp(): void
{
$this->reflectionService = $this->createMock(ReflectionService::class);
$this->objectManager = $this->createMock(ObjectManagerInterface::class);
@@ -59,37 +59,37 @@ public function executeReturnsQueryResultInstance()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setLimitAcceptsOnlyIntegers()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->query->setLimit(1.5);
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setLimitRejectsIntegersLessThanOne()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->query->setLimit(0);
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setOffsetAcceptsOnlyIntegers()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->query->setOffset(1.5);
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setOffsetRejectsIntegersLessThanZero()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->query->setOffset(-1);
}
}
diff --git a/Neos.Flow/Tests/Unit/Persistence/RepositoryTest.php b/Neos.Flow/Tests/Unit/Persistence/RepositoryTest.php
index 30babbf8bd..4e430edcd1 100644
--- a/Neos.Flow/Tests/Unit/Persistence/RepositoryTest.php
+++ b/Neos.Flow/Tests/Unit/Persistence/RepositoryTest.php
@@ -14,6 +14,7 @@
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Persistence;
use Neos\Flow\Tests\Persistence\Fixture;
+use PHPUnit\Framework\Error\Error;
require_once('Fixture/Repository/NonstandardEntityRepository.php');
@@ -237,20 +238,20 @@ public function magicCallMethodAcceptsCountBySomethingCallsAndExecutesAQueryWith
/**
* @test
- * @expectedException \PHPUnit\Framework\Error\Error
*/
public function magicCallMethodTriggersAnErrorIfUnknownMethodsAreCalled()
{
+ $this->expectException(Error::class);
$repository = $this->getMockBuilder(Persistence\Repository::class)->setMethods(['createQuery'])->getMock();
$repository->__call('foo', []);
}
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\IllegalObjectTypeException
*/
public function addChecksObjectType()
{
+ $this->expectException(Persistence\Exception\IllegalObjectTypeException::class);
$repository = $this->getAccessibleMock(Persistence\Repository::class, ['dummy']);
$repository->_set('entityClassName', 'ExpectedObjectType');
@@ -259,10 +260,10 @@ public function addChecksObjectType()
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\IllegalObjectTypeException
*/
public function removeChecksObjectType()
{
+ $this->expectException(Persistence\Exception\IllegalObjectTypeException::class);
$repository = $this->getAccessibleMock(Persistence\Repository::class, ['dummy']);
$repository->_set('entityClassName', 'ExpectedObjectType');
@@ -270,10 +271,10 @@ public function removeChecksObjectType()
}
/**
* @test
- * @expectedException \Neos\Flow\Persistence\Exception\IllegalObjectTypeException
*/
public function updateChecksObjectType()
{
+ $this->expectException(Persistence\Exception\IllegalObjectTypeException::class);
$repository = $this->getAccessibleMock(Persistence\Repository::class, ['dummy']);
$repository->_set('entityClassName', 'ExpectedObjectType');
diff --git a/Neos.Flow/Tests/Unit/Property/PropertyMapperTest.php b/Neos.Flow/Tests/Unit/Property/PropertyMapperTest.php
index f0df199b03..3e703a12c7 100644
--- a/Neos.Flow/Tests/Unit/Property/PropertyMapperTest.php
+++ b/Neos.Flow/Tests/Unit/Property/PropertyMapperTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Property\Exception\DuplicateTypeConverterException;
+use Neos\Flow\Property\Exception\InvalidSourceException;
use Neos\Flow\Property\Exception\InvalidTargetException;
use Neos\Flow\Property\Exception\TypeConverterException;
use Neos\Flow\Property\PropertyMapper;
@@ -37,7 +38,7 @@ class PropertyMapperTest extends UnitTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockConfiguration = $this->createMock(PropertyMappingConfigurationInterface::class);
}
@@ -80,10 +81,10 @@ public function invalidSourceTypes()
/**
* @test
* @dataProvider invalidSourceTypes
- * @expectedException \Neos\Flow\Property\Exception\InvalidSourceException
*/
public function sourceWhichIsNoSimpleTypeOrObjectThrowsException($source)
{
+ $this->expectException(InvalidSourceException::class);
$propertyMapper = $this->getAccessibleMock(PropertyMapper::class, ['dummy']);
$propertyMapper->_call('determineSourceTypes', $source);
}
@@ -194,10 +195,10 @@ public function findEligibleConverterWithHighestPrioritySkipsConvertersWithNegat
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\TypeConverterException
*/
public function findTypeConverterThrowsExceptionIfAllMatchingConvertersHaveNegativePriorities()
{
+ $this->expectException(TypeConverterException::class);
$internalTypeConverter1 = $this->getMockTypeConverter('string2string,prio-1');
$internalTypeConverter1->expects($this->atLeastOnce())->method('getPriority')->will($this->returnValue(-1));
@@ -389,10 +390,10 @@ public function convertShouldAskConfigurationBuilderForDefaultConfiguration()
/**
* @test
- * @expectedException Exception
*/
public function convertDoesNotCatchSecurityExceptions()
{
+ $this->expectException(Exception::class);
$propertyMapper = $this->getAccessibleMock(PropertyMapper::class, ['doMapping']);
$propertyMapper->expects($this->once())->method('doMapping')->with('sourceType', 'targetType', $this->mockConfiguration)->will($this->throwException(new Exception()));
diff --git a/Neos.Flow/Tests/Unit/Property/PropertyMappingConfigurationTest.php b/Neos.Flow/Tests/Unit/Property/PropertyMappingConfigurationTest.php
index 1d3fd50558..23b935c82e 100644
--- a/Neos.Flow/Tests/Unit/Property/PropertyMappingConfigurationTest.php
+++ b/Neos.Flow/Tests/Unit/Property/PropertyMappingConfigurationTest.php
@@ -32,7 +32,7 @@ class PropertyMappingConfigurationTest extends UnitTestCase
/**
* Initialization
*/
- public function setUp()
+ protected function setUp(): void
{
$this->propertyMappingConfiguration = new PropertyMappingConfiguration();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayConverterTest.php
index 4aad677b55..640399a41a 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayConverterTest.php
@@ -26,7 +26,7 @@ class ArrayConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new ArrayConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayFromObjectConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayFromObjectConverterTest.php
index f189c8f787..e1ff641c88 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayFromObjectConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/ArrayFromObjectConverterTest.php
@@ -25,7 +25,7 @@ class ArrayFromObjectConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new ArrayFromObjectConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/BooleanConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/BooleanConverterTest.php
index 9ecc08f04f..5ef831de9e 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/BooleanConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/BooleanConverterTest.php
@@ -24,7 +24,7 @@ class BooleanConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new BooleanConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/CollectionConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/CollectionConverterTest.php
index ca68e2bd47..39f8c13141 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/CollectionConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/CollectionConverterTest.php
@@ -25,7 +25,7 @@ class CollectionConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new CollectionConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php
index f10be1bffb..f3ede9c565 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/DateTimeConverterTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Property\Exception\TypeConverterException;
use Neos\Flow\Property\TypeConverter\DateTimeConverter;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Property\PropertyMappingConfiguration;
@@ -29,7 +30,7 @@ class DateTimeConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new DateTimeConverter();
}
@@ -276,10 +277,10 @@ public function convertFromReturnsErrorIfGivenArrayCantBeConverted()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\TypeConverterException
*/
public function convertFromThrowsExceptionIfGivenArrayDoesNotSpecifyTheDate()
{
+ $this->expectException(TypeConverterException::class);
$this->converter->convertFrom(['hour' => '12', 'minute' => '30'], 'DateTime');
}
@@ -312,11 +313,11 @@ public function invalidDatePartKeyValuesDataProvider()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\TypeConverterException
* @dataProvider invalidDatePartKeyValuesDataProvider
*/
public function convertFromThrowsExceptionIfDatePartKeysHaveInvalidValuesSpecified($source)
{
+ $this->expectException(TypeConverterException::class);
$this->converter->convertFrom($source, 'DateTime');
}
@@ -414,10 +415,10 @@ public function convertFromAllowsToOverrideTheTimezoneForImmutableTargetType()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\TypeConverterException
*/
public function convertFromThrowsExceptionIfSpecifiedTimezoneIsInvalid()
{
+ $this->expectException(TypeConverterException::class);
$source = [
'date' => '2011-06-16',
'dateFormat' => 'Y-m-d',
@@ -428,10 +429,10 @@ public function convertFromThrowsExceptionIfSpecifiedTimezoneIsInvalid()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\TypeConverterException
*/
public function convertFromArrayThrowsExceptionForEmptyArray()
{
+ $this->expectException(TypeConverterException::class);
$this->converter->convertFrom([], 'DateTime', [], null);
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/FloatConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/FloatConverterTest.php
index 7f895eeafc..7bde198576 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/FloatConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/FloatConverterTest.php
@@ -28,7 +28,7 @@ class FloatConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new FloatConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/IntegerConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/IntegerConverterTest.php
index 5b5d34318f..0672c59e87 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/IntegerConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/IntegerConverterTest.php
@@ -28,7 +28,7 @@ class IntegerConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new IntegerConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/MediaTypeConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/MediaTypeConverterTest.php
index c85815e217..dc05d276fd 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/MediaTypeConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/MediaTypeConverterTest.php
@@ -34,7 +34,7 @@ class MediaTypeConverterTest extends UnitTestCase
/**
* Set up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mediaTypeConverter = new MediaTypeConverter();
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/ObjectConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/ObjectConverterTest.php
index 0d4a49556e..aa20aa98ed 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/ObjectConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/ObjectConverterTest.php
@@ -40,7 +40,7 @@ class ObjectConverterTest extends UnitTestCase
*/
protected $mockObjectManager;
- public function setUp()
+ protected function setUp(): void
{
$this->mockReflectionService = $this->createMock(ReflectionService::class);
$this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php
index cd140fff67..a1a6762d27 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php
@@ -15,6 +15,10 @@
use Neos\Flow\Fixtures\ClassWithSettersAndConstructor;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Persistence;
+use Neos\Flow\Property\Exception\DuplicateObjectException;
+use Neos\Flow\Property\Exception\InvalidPropertyMappingConfigurationException;
+use Neos\Flow\Property\Exception\InvalidSourceException;
+use Neos\Flow\Property\Exception\InvalidTargetException;
use Neos\Flow\Property\PropertyMappingConfiguration;
use Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError;
use Neos\Flow\Property\TypeConverter\PersistentObjectConverter;
@@ -52,7 +56,7 @@ class PersistentObjectConverterTest extends UnitTestCase
*/
protected $mockObjectManager;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new PersistentObjectConverter();
$this->mockReflectionService = $this->createMock(ReflectionService::class);
@@ -244,10 +248,10 @@ public function convertFromShouldFetchObjectFromPersistenceIfOnlyIdentityArrayGi
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidPropertyMappingConfigurationException
*/
public function convertFromShouldThrowExceptionIfObjectNeedsToBeModifiedButConfigurationIsNotSet()
{
+ $this->expectException(InvalidPropertyMappingConfigurationException::class);
$identifier = '550e8400-e29b-11d4-a716-446655440000';
$object = new \stdClass();
$object->someProperty = 'asdf';
@@ -295,7 +299,7 @@ protected function buildConfiguration($typeConverterOptions)
* @param \PHPUnit_Framework_MockObject_Matcher_Invocation $howOftenIsGetFirstCalled
* @return \stdClass
*/
- public function setupMockQuery($numberOfResults, $howOftenIsGetFirstCalled)
+ protected function setUpMockQuery($numberOfResults, $howOftenIsGetFirstCalled)
{
$mockClassSchema = $this->createMock(ClassSchema::class, [], ['Dummy']);
$mockClassSchema->expects($this->once())->method('getIdentityProperties')->will($this->returnValue(['key1' => 'someType']));
@@ -347,10 +351,10 @@ public function convertFromShouldReturnTargetNotFoundErrorIfNoMatchingObjectWasF
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidSourceException
*/
public function convertFromShouldThrowExceptionIfIdentityIsOfInvalidType()
{
+ $this->expectException(InvalidSourceException::class);
$source = [
'__identity' => new \stdClass(),
];
@@ -359,10 +363,10 @@ public function convertFromShouldThrowExceptionIfIdentityIsOfInvalidType()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\DuplicateObjectException
*/
public function convertFromShouldThrowExceptionIfMoreThanOneObjectWasFound()
{
+ $this->expectException(DuplicateObjectException::class);
$this->setupMockQuery(2, $this->never());
$source = [
@@ -373,10 +377,10 @@ public function convertFromShouldThrowExceptionIfMoreThanOneObjectWasFound()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidPropertyMappingConfigurationException
*/
public function convertFromShouldThrowExceptionIfObjectNeedsToBeCreatedButConfigurationIsNotSet()
{
+ $this->expectException(InvalidPropertyMappingConfigurationException::class);
$source = [
'foo' => 'bar'
];
@@ -406,10 +410,10 @@ public function convertFromShouldCreateObject()
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidTargetException
*/
public function convertFromShouldThrowExceptionIfPropertyOnTargetObjectCouldNotBeSet()
{
+ $this->expectException(InvalidTargetException::class);
$source = [
'propertyX' => 'bar'
];
@@ -473,10 +477,10 @@ public function convertFromShouldCreateObjectWhenThereAreOptionalConstructorPara
/**
* @test
- * @expectedException \Neos\Flow\Property\Exception\InvalidTargetException
*/
public function convertFromShouldThrowExceptionIfRequiredConstructorParameterWasNotFound()
{
+ $this->expectException(InvalidTargetException::class);
$source = [
'propertyX' => 'bar'
];
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/ScalarTypeToObjectConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/ScalarTypeToObjectConverterTest.php
index bfd90d898d..d9ccab29b9 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/ScalarTypeToObjectConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/ScalarTypeToObjectConverterTest.php
@@ -35,7 +35,7 @@ class ScalarTypeToObjectConverterTest extends UnitTestCase
*/
protected $reflectionMock;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/StringConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/StringConverterTest.php
index 689b4d67f4..e5ab624835 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/StringConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/StringConverterTest.php
@@ -27,7 +27,7 @@ class StringConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new StringConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/TypedArrayConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/TypedArrayConverterTest.php
index b77a03103a..314c3f014f 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/TypedArrayConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/TypedArrayConverterTest.php
@@ -25,7 +25,7 @@ class TypedArrayConverterTest extends UnitTestCase
*/
protected $converter;
- public function setUp()
+ protected function setUp(): void
{
$this->converter = new TypedArrayConverter();
}
diff --git a/Neos.Flow/Tests/Unit/Property/TypeConverter/UriTypeConverterTest.php b/Neos.Flow/Tests/Unit/Property/TypeConverter/UriTypeConverterTest.php
index d4048b2009..981e49415f 100644
--- a/Neos.Flow/Tests/Unit/Property/TypeConverter/UriTypeConverterTest.php
+++ b/Neos.Flow/Tests/Unit/Property/TypeConverter/UriTypeConverterTest.php
@@ -28,7 +28,7 @@ class UriTypeConverterTest extends UnitTestCase
/**
*/
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->typeConverter = new UriTypeConverter();
diff --git a/Neos.Flow/Tests/Unit/Reflection/ClassReflectionTest.php b/Neos.Flow/Tests/Unit/Reflection/ClassReflectionTest.php
index 496c171de6..45f67de769 100644
--- a/Neos.Flow/Tests/Unit/Reflection/ClassReflectionTest.php
+++ b/Neos.Flow/Tests/Unit/Reflection/ClassReflectionTest.php
@@ -77,7 +77,7 @@ public function getMethodsReturnsArrayWithNumericIndex()
$class = new ClassReflection(__CLASS__);
$methods = $class->getMethods();
foreach (array_keys($methods) as $key) {
- $this->assertInternalType('integer', $key, 'The index was not an integer.');
+ $this->assertIsInt($key, 'The index was not an integer.');
}
}
diff --git a/Neos.Flow/Tests/Unit/Reflection/ClassSchemaTest.php b/Neos.Flow/Tests/Unit/Reflection/ClassSchemaTest.php
index 15be2e80cd..f7dee9d44b 100644
--- a/Neos.Flow/Tests/Unit/Reflection/ClassSchemaTest.php
+++ b/Neos.Flow/Tests/Unit/Reflection/ClassSchemaTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Reflection\ClassSchema;
+use Neos\Flow\Reflection\Exception\ClassSchemaConstraintViolationException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -83,10 +84,10 @@ public function isPropertyTransientReturnsAttributeForAddedProperties()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function markAsIdentityPropertyRejectsUnknownProperties()
{
+ $this->expectException(\InvalidArgumentException::class);
$classSchema = new ClassSchema('SomeClass');
$classSchema->markAsIdentityProperty('unknownProperty');
@@ -94,10 +95,10 @@ public function markAsIdentityPropertyRejectsUnknownProperties()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function markAsIdentityPropertyRejectsLazyLoadedProperties()
{
+ $this->expectException(\InvalidArgumentException::class);
$classSchema = new ClassSchema('SomeClass');
$classSchema->addProperty('lazyProperty', 'Neos\Flow\SomeObject', true);
@@ -168,10 +169,10 @@ public function invalidPropertyTypes()
/**
* @dataProvider invalidPropertyTypes()
* @test
- * @expectedException \InvalidArgumentException
*/
public function addPropertyRejectsInvalidPropertyTypes($propertyType)
{
+ $this->expectException(\InvalidArgumentException::class);
$classSchema = new ClassSchema('SomeClass');
$classSchema->addProperty('a', $propertyType);
}
@@ -193,10 +194,10 @@ public function addPropertyStoresElementTypesForCollectionProperties()
/**
* @test
- * @expectedException \Neos\Flow\Reflection\Exception\ClassSchemaConstraintViolationException
*/
public function markAsIdentityPropertyThrowsExceptionForValueObjects()
{
+ $this->expectException(ClassSchemaConstraintViolationException::class);
$classSchema = new ClassSchema('SomeClass');
$classSchema->setModelType(ClassSchema::MODELTYPE_VALUEOBJECT);
$classSchema->markAsIdentityProperty('foo');
diff --git a/Neos.Flow/Tests/Unit/Reflection/PropertyReflectionTest.php b/Neos.Flow/Tests/Unit/Reflection/PropertyReflectionTest.php
index 9817cc96a5..4009737399 100644
--- a/Neos.Flow/Tests/Unit/Reflection/PropertyReflectionTest.php
+++ b/Neos.Flow/Tests/Unit/Reflection/PropertyReflectionTest.php
@@ -36,10 +36,10 @@ class PropertyReflectionTest extends UnitTestCase
/**
* @test
- * @expectedException \Neos\Flow\Reflection\Exception
*/
public function getValueThrowsAnExceptionOnReflectingANonObject()
{
+ $this->expectException(Reflection\Exception::class);
$reflectionProperty = new Reflection\PropertyReflection(__CLASS__, 'protectedProperty');
$reflectionProperty->getValue(__CLASS__);
}
diff --git a/Neos.Flow/Tests/Unit/Reflection/ReflectionServiceTest.php b/Neos.Flow/Tests/Unit/Reflection/ReflectionServiceTest.php
index a800c164c6..e07261a140 100644
--- a/Neos.Flow/Tests/Unit/Reflection/ReflectionServiceTest.php
+++ b/Neos.Flow/Tests/Unit/Reflection/ReflectionServiceTest.php
@@ -12,6 +12,7 @@
*/
use Doctrine\Common\Annotations\Reader;
+use Neos\Flow\Reflection\Exception\ClassLoadingForReflectionFailedException;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\Tests\UnitTestCase;
@@ -31,7 +32,7 @@ class ReflectionServiceTest extends UnitTestCase
*/
protected $mockAnnotationReader;
- public function setUp()
+ protected function setUp(): void
{
$this->reflectionService = $this->getAccessibleMock(ReflectionService::class, null);
@@ -42,28 +43,28 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Flow\Reflection\Exception\ClassLoadingForReflectionFailedException
*/
public function reflectClassThrowsExceptionForNonExistingClasses()
{
+ $this->expectException(ClassLoadingForReflectionFailedException::class);
$this->reflectionService->_call('reflectClass', 'Non\Existing\Class');
}
/**
* @test
- * @expectedException \Neos\Flow\Reflection\Exception\ClassLoadingForReflectionFailedException
*/
public function reflectClassThrowsExceptionForFilesWithNoClass()
{
+ $this->expectException(ClassLoadingForReflectionFailedException::class);
$this->reflectionService->_call('reflectClass', Fixture\FileWithNoClass::class);
}
/**
* @test
- * @expectedException \Neos\Flow\Reflection\Exception\ClassLoadingForReflectionFailedException
*/
public function reflectClassThrowsExceptionForClassesWithNoMatchingFilename()
{
+ $this->expectException(ClassLoadingForReflectionFailedException::class);
$this->reflectionService->_call('reflectClass', Fixture\ClassWithDifferentNameDifferent::class);
}
diff --git a/Neos.Flow/Tests/Unit/ResourceManagement/PersistentResourceTest.php b/Neos.Flow/Tests/Unit/ResourceManagement/PersistentResourceTest.php
index 76596509dc..8a1af52af4 100644
--- a/Neos.Flow/Tests/Unit/ResourceManagement/PersistentResourceTest.php
+++ b/Neos.Flow/Tests/Unit/ResourceManagement/PersistentResourceTest.php
@@ -93,10 +93,10 @@ public function invalidSha1Values()
/**
* @test
* @dataProvider invalidSha1Values
- * @expectedException \InvalidArgumentException
*/
public function setSha1RejectsInvalidValues($invalidValue)
{
+ $this->expectException(\InvalidArgumentException::class);
$resource = new PersistentResource();
$resource->setSha1($invalidValue);
$this->assertSame('d0be2dc421be4fcd0172e5afceea3970e2f3d940', $resource->getSha1());
diff --git a/Neos.Flow/Tests/Unit/ResourceManagement/ResourceTypeConverterTest.php b/Neos.Flow/Tests/Unit/ResourceManagement/ResourceTypeConverterTest.php
index 3a7e06985d..4a1b920f5f 100644
--- a/Neos.Flow/Tests/Unit/ResourceManagement/ResourceTypeConverterTest.php
+++ b/Neos.Flow/Tests/Unit/ResourceManagement/ResourceTypeConverterTest.php
@@ -41,7 +41,7 @@ class ResourceTypeConverterTest extends UnitTestCase
*/
protected $mockResourceManager;
- public function setUp()
+ protected function setUp(): void
{
$this->resourceTypeConverter = $this->getAccessibleMock(ResourceTypeConverter::class, ['dummy']);
diff --git a/Neos.Flow/Tests/Unit/ResourceManagement/Storage/WritableFileSystemStorageTest.php b/Neos.Flow/Tests/Unit/ResourceManagement/Storage/WritableFileSystemStorageTest.php
index ddce5ce6fe..3573ea522e 100644
--- a/Neos.Flow/Tests/Unit/ResourceManagement/Storage/WritableFileSystemStorageTest.php
+++ b/Neos.Flow/Tests/Unit/ResourceManagement/Storage/WritableFileSystemStorageTest.php
@@ -38,7 +38,7 @@ class WritableFileSystemStorageTest extends UnitTestCase
*/
protected $mockEnvironment;
- public function setUp()
+ protected function setUp(): void
{
$this->mockDirectory = vfsStream::setup('WritableFileSystemStorageTest');
diff --git a/Neos.Flow/Tests/Unit/ResourceManagement/Streams/ResourceStreamWrapperTest.php b/Neos.Flow/Tests/Unit/ResourceManagement/Streams/ResourceStreamWrapperTest.php
index 5717b6c3a3..2ad561904f 100644
--- a/Neos.Flow/Tests/Unit/ResourceManagement/Streams/ResourceStreamWrapperTest.php
+++ b/Neos.Flow/Tests/Unit/ResourceManagement/Streams/ResourceStreamWrapperTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Package\FlowPackageInterface;
+use Neos\Flow\ResourceManagement\Exception;
use org\bovigo\vfs\vfsStream;
use Neos\Flow\Package\PackageManager;
use Neos\Flow\ResourceManagement\PersistentResource;
@@ -39,7 +40,7 @@ class ResourceStreamWrapperTest extends UnitTestCase
*/
protected $mockResourceManager;
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
@@ -54,10 +55,10 @@ public function setUp()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function openThrowsExceptionForInvalidScheme()
{
+ $this->expectException(\InvalidArgumentException::class);
$openedPathAndFilename = '';
$this->resourceStreamWrapper->open('invalid-scheme://foo/bar', 'r', 0, $openedPathAndFilename);
}
@@ -100,10 +101,10 @@ public function openResolvesAnUpperCaseSha1HashUsingTheResourceManager()
/**
* @test
- * @expectedException \Neos\Flow\ResourceManagement\Exception
*/
public function openThrowsExceptionForNonExistingPackages()
{
+ $this->expectException(Exception::class);
$packageKey = 'Non.Existing.Package';
$this->mockPackageManager->expects(self::once())->method('getPackage')->willThrowException(new \Neos\Flow\Package\Exception\UnknownPackageException('Test exception'));
diff --git a/Neos.Flow/Tests/Unit/ResourceManagement/Streams/StreamWrapperAdapterTest.php b/Neos.Flow/Tests/Unit/ResourceManagement/Streams/StreamWrapperAdapterTest.php
index e45d868015..d415f7766e 100644
--- a/Neos.Flow/Tests/Unit/ResourceManagement/Streams/StreamWrapperAdapterTest.php
+++ b/Neos.Flow/Tests/Unit/ResourceManagement/Streams/StreamWrapperAdapterTest.php
@@ -31,7 +31,7 @@ class StreamWrapperAdapterTest extends UnitTestCase
protected $mockStreamWrapper;
- public function setUp()
+ protected function setUp(): void
{
$this->streamWrapperAdapter = $this->getAccessibleMock(StreamWrapperAdapter::class, ['createStreamWrapper']);
$this->mockStreamWrapper = $this->createMock(StreamWrapperInterface::class);
diff --git a/Neos.Flow/Tests/Unit/ResourceManagement/Target/FileSystemTargetTest.php b/Neos.Flow/Tests/Unit/ResourceManagement/Target/FileSystemTargetTest.php
index 05698f735a..6993071ece 100644
--- a/Neos.Flow/Tests/Unit/ResourceManagement/Target/FileSystemTargetTest.php
+++ b/Neos.Flow/Tests/Unit/ResourceManagement/Target/FileSystemTargetTest.php
@@ -21,6 +21,7 @@
use Neos\Flow\ResourceManagement\Collection;
use Neos\Flow\ResourceManagement\PersistentResource;
use Neos\Flow\ResourceManagement\Storage\PackageStorage;
+use Neos\Flow\ResourceManagement\Target\Exception;
use Neos\Flow\ResourceManagement\Target\FileSystemTarget;
use Neos\Flow\Tests\UnitTestCase;
use org\bovigo\vfs\vfsStream;
@@ -51,7 +52,7 @@ class FileSystemTargetTest extends UnitTestCase
*/
protected $mockHttpRequest;
- public function setUp()
+ protected function setUp(): void
{
$this->fileSystemTarget = new FileSystemTarget('test');
@@ -118,10 +119,10 @@ public function getPublicStaticResourceUriFallsBackToConfiguredHttpBaseUri()
/**
* @test
- * @expectedException \Neos\Flow\ResourceManagement\Target\Exception
*/
public function getPublicStaticResourceUriThrowsExceptionIfBaseUriCantBeResolved()
{
+ $this->expectException(Exception::class);
$mockBootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
$mockCommandRequestHandler = $this->getMockBuilder(CommandRequestHandler::class)->disableOriginalConstructor()->getMock();
$mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockCommandRequestHandler));
@@ -186,10 +187,10 @@ public function getPublicPersistentResourceUriFallsBackToConfiguredHttpBaseUri()
/**
* @test
- * @expectedException \Neos\Flow\ResourceManagement\Target\Exception
*/
public function getPublicPersistentResourceUriThrowsExceptionIfBaseUriCantBeResolved()
{
+ $this->expectException(Exception::class);
$mockBootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
$mockCommandRequestHandler = $this->getMockBuilder(CommandRequestHandler::class)->disableOriginalConstructor()->getMock();
$mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($mockCommandRequestHandler));
diff --git a/Neos.Flow/Tests/Unit/Security/AccountTest.php b/Neos.Flow/Tests/Unit/Security/AccountTest.php
index 8b334c85c6..1653010622 100644
--- a/Neos.Flow/Tests/Unit/Security/AccountTest.php
+++ b/Neos.Flow/Tests/Unit/Security/AccountTest.php
@@ -40,7 +40,7 @@ class AccountTest extends UnitTestCase
/**
* Setup function for the test case
*/
- public function setUp()
+ protected function setUp(): void
{
$administratorRole = new Role('Neos.Flow:Administrator');
$this->administratorRole = $administratorRole;
diff --git a/Neos.Flow/Tests/Unit/Security/Aspect/PolicyEnforcementAspectTest.php b/Neos.Flow/Tests/Unit/Security/Aspect/PolicyEnforcementAspectTest.php
index 6e43b72379..9bccf785bf 100644
--- a/Neos.Flow/Tests/Unit/Security/Aspect/PolicyEnforcementAspectTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Aspect/PolicyEnforcementAspectTest.php
@@ -47,7 +47,7 @@ class PolicyEnforcementAspectTest extends UnitTestCase
*/
protected $policyEnforcementAspect;
- public function setUp()
+ protected function setUp(): void
{
$this->mockJoinPoint = $this->getMockBuilder(JoinPointInterface::class)->disableOriginalConstructor()->getMock();
$this->mockAdviceChain = $this->getMockBuilder(AdviceChain::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderManagerTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderManagerTest.php
index eceabe8dc9..b49edfec50 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderManagerTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Security\Authentication\AuthenticationProviderInterface;
use Neos\Flow\Security\Authentication\TokenAndProviderFactoryInterface;
+use Neos\Flow\Security\Exception\AuthenticationRequiredException;
use Neos\Flow\Session\SessionManager;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Security\Account;
@@ -54,7 +55,7 @@ class AuthenticationProviderManagerTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->tokenAndProviderFactory = $this->getMockBuilder(TokenAndProviderFactoryInterface::class)->getMock();
$this->authenticationProviderManager = $this->getAccessibleMock(AuthenticationProviderManager::class, ['dummy'], [$this->tokenAndProviderFactory], '', true);
@@ -159,10 +160,10 @@ public function authenticateAuthenticatesOnlyTokensWithStatusAuthenticationNeede
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\AuthenticationRequiredException
*/
public function authenticateThrowsAnExceptionIfNoTokenCouldBeAuthenticated()
{
+ $this->expectException(AuthenticationRequiredException::class);
$token1 = $this->createMock(TokenInterface::class);
$token2 = $this->createMock(TokenInterface::class);
@@ -176,10 +177,10 @@ public function authenticateThrowsAnExceptionIfNoTokenCouldBeAuthenticated()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\AuthenticationRequiredException
*/
public function authenticateThrowsAnExceptionIfAuthenticateAllTokensIsTrueButATokenCouldNotBeAuthenticated()
{
+ $this->expectException(AuthenticationRequiredException::class);
$token1 = $this->createMock(TokenInterface::class);
$token2 = $this->createMock(TokenInterface::class);
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderResolverTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderResolverTest.php
index 224140ec80..fd6ce99d75 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderResolverTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/AuthenticationProviderResolverTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\ObjectManagement\ObjectManager;
use Neos\Flow\Security\Authentication\AuthenticationProviderResolver;
+use Neos\Flow\Security\Exception\NoAuthenticationProviderFoundException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -22,10 +23,10 @@ class AuthenticationProviderResolverTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\NoAuthenticationProviderFoundException
*/
public function resolveProviderObjectNameThrowsAnExceptionIfNoProviderIsAvailable()
{
+ $this->expectException(NoAuthenticationProviderFoundException::class);
$mockObjectManager = $this->getMockBuilder(ObjectManager::class)->disableOriginalConstructor()->getMock();
$mockObjectManager->expects($this->any())->method('getClassNameByObjectName')->will($this->returnValue(false));
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/EntryPoint/WebRedirectTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/EntryPoint/WebRedirectTest.php
index 7f8fa71db6..1fa7230170 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/EntryPoint/WebRedirectTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/EntryPoint/WebRedirectTest.php
@@ -16,6 +16,7 @@
use Neos\Flow\Http\Uri;
use Neos\Flow\Mvc\Routing\UriBuilder;
use Neos\Flow\Security\Authentication\EntryPoint\WebRedirect;
+use Neos\Flow\Security\Exception\MissingConfigurationException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -25,10 +26,10 @@ class WebRedirectTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\MissingConfigurationException
*/
public function startAuthenticationThrowsAnExceptionIfTheConfigurationOptionsAreMissing()
{
+ $this->expectException(MissingConfigurationException::class);
$request = Request::create(new Uri('http://robertlemke.com/admin'));
$response = new Response();
@@ -73,10 +74,10 @@ public function startAuthenticationDoesNotPrefixAConfiguredUriIfItsAbsolute()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\MissingConfigurationException
*/
public function startAuthenticationThrowsAnExceptionIfTheConfiguredRoutePartsAreInvalid()
{
+ $this->expectException(MissingConfigurationException::class);
$request = Request::create(new Uri('http://robertlemke.com/admin'));
$response = new Response();
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/Provider/FileBasedSimpleKeyProviderTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/Provider/FileBasedSimpleKeyProviderTest.php
index 5ae8b58e74..fd852d1ecd 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/Provider/FileBasedSimpleKeyProviderTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/Provider/FileBasedSimpleKeyProviderTest.php
@@ -16,6 +16,7 @@
use Neos\Flow\Security\Authentication\TokenInterface;
use Neos\Flow\Security\Cryptography\FileBasedSimpleKeyService;
use Neos\Flow\Security\Cryptography\HashService;
+use Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException;
use Neos\Flow\Security\Policy\PolicyService;
use Neos\Flow\Security\Policy\Role;
use Neos\Flow\Tests\UnitTestCase;
@@ -61,7 +62,7 @@ class FileBasedSimpleKeyProviderTest extends UnitTestCase
*/
protected $mockToken;
- public function setUp()
+ protected function setUp(): void
{
$this->mockRole = $this->getMockBuilder(Role::class)->disableOriginalConstructor()->getMock();
$this->mockRole->expects($this->any())->method('getIdentifier')->will($this->returnValue('Neos.Flow:TestRoleIdentifier'));
@@ -161,10 +162,10 @@ public function getTokenClassNameReturnsCorrectClassNames()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException
*/
public function authenticatingAnUnsupportedTokenThrowsAnException()
{
+ $this->expectException(UnsupportedAuthenticationTokenException::class);
$someInvalidToken = $this->createMock(TokenInterface::class);
$authenticationProvider = FileBasedSimpleKeyProvider::create('myProvider', []);
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php
index 46975cc93d..41d2556a3d 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/Provider/PersistedUsernamePasswordProviderTest.php
@@ -56,7 +56,7 @@ class PersistedUsernamePasswordProviderTest extends UnitTestCase
protected $persistedUsernamePasswordProvider;
- public function setUp()
+ protected function setUp(): void
{
$this->mockHashService = $this->createMock(Security\Cryptography\HashService::class);
$this->mockAccount = $this->getMockBuilder(Security\Account::class)->disableOriginalConstructor()->getMock();
@@ -128,10 +128,10 @@ public function authenticationFailsWithWrongCredentialsInAnUsernamePasswordToken
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException
*/
public function authenticatingAnUnsupportedTokenThrowsAnException()
{
+ $this->expectException(Security\Exception\UnsupportedAuthenticationTokenException::class);
$someNiceToken = $this->createMock(Security\Authentication\TokenInterface::class);
$usernamePasswordProvider = Security\Authentication\Provider\PersistedUsernamePasswordProvider::create('myProvider', []);
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/Token/AbstractTokenTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/Token/AbstractTokenTest.php
index 98c2987fba..c9190f2636 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/Token/AbstractTokenTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/Token/AbstractTokenTest.php
@@ -14,6 +14,7 @@
use Neos\Flow\Security\Authentication\EntryPoint\WebRedirect;
use Neos\Flow\Security\Authentication\Token\AbstractToken;
use Neos\Flow\Security\Authentication\TokenInterface;
+use Neos\Flow\Security\Exception\InvalidAuthenticationStatusException;
use Neos\Flow\Security\RequestPattern\Uri as UriRequestPattern;
use Neos\Flow\Tests\UnitTestCase;
@@ -28,7 +29,7 @@ class AbstractTokenTest extends UnitTestCase
*/
protected $token;
- public function setup()
+ protected function setUp(): void
{
$this->token = $this->getMockForAbstractClass(AbstractToken::class);
}
@@ -91,10 +92,10 @@ public function isAuthenticatedReturnsTheCorrectValueForAGivenStatus($status, $i
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidAuthenticationStatusException
*/
public function setAuthenticationStatusThrowsAnExceptionForAnInvalidStatus()
{
+ $this->expectException(InvalidAuthenticationStatusException::class);
$this->token->setAuthenticationStatus(-1);
}
@@ -114,10 +115,10 @@ public function requestPatternsCanBeSetRetrievedAndChecked()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setRequestPatternsOnlyAcceptsRequestPatterns()
{
+ $this->expectException(\InvalidArgumentException::class);
$uriRequestPattern = new UriRequestPattern(['uriPattern' => 'http://mydomain.com/some/path/pattern']);
$this->token->setRequestPatterns([$uriRequestPattern, 'no valid pattern']);
}
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/Token/PasswordTokenTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/Token/PasswordTokenTest.php
index 0cbc1a71fb..e3dd129d28 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/Token/PasswordTokenTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/Token/PasswordTokenTest.php
@@ -40,7 +40,7 @@ class PasswordTokenTest extends UnitTestCase
/**
* Set up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->token = new PasswordToken();
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordHttpBasicTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordHttpBasicTest.php
index 1412298d31..1e6d2c710c 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordHttpBasicTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordHttpBasicTest.php
@@ -32,7 +32,7 @@ class UsernamePasswordHttpBasicTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->token = new UsernamePasswordHttpBasic();
}
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordTest.php
index d83a0fda77..692685494f 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/Token/UsernamePasswordTest.php
@@ -41,7 +41,7 @@ class UsernamePasswordTest extends UnitTestCase
/**
* Set up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->token = new UsernamePassword();
diff --git a/Neos.Flow/Tests/Unit/Security/Authentication/TokenAndProviderFactoryTest.php b/Neos.Flow/Tests/Unit/Security/Authentication/TokenAndProviderFactoryTest.php
index b1646a6ea5..8c9491c41a 100644
--- a/Neos.Flow/Tests/Unit/Security/Authentication/TokenAndProviderFactoryTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authentication/TokenAndProviderFactoryTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Security\Authentication\AuthenticationProviderResolver;
use Neos\Flow\Security\Authentication\TokenAndProviderFactory;
+use Neos\Flow\Security\Exception\InvalidAuthenticationProviderException;
use Neos\Flow\Security\RequestPatternResolver;
use Neos\Flow\Tests\UnitTestCase;
@@ -37,10 +38,10 @@ public function noTokensAndProvidersAreBuiltIfTheConfigurationArrayIsEmpty()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidAuthenticationProviderException
*/
public function anExceptionIsThrownIfTheConfiguredProviderDoesNotExist()
{
+ $this->expectException(InvalidAuthenticationProviderException::class);
$providerConfiguration = [
'NotExistingProvider' => [
'providerClass' => 'NotExistingProviderClass'
diff --git a/Neos.Flow/Tests/Unit/Security/Authorization/FilterFirewallTest.php b/Neos.Flow/Tests/Unit/Security/Authorization/FilterFirewallTest.php
index c4f7f73687..031f466f5e 100644
--- a/Neos.Flow/Tests/Unit/Security/Authorization/FilterFirewallTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authorization/FilterFirewallTest.php
@@ -18,6 +18,7 @@
use Neos\Flow\Security\Authorization\InterceptorInterface;
use Neos\Flow\Security\Authorization\InterceptorResolver;
use Neos\Flow\Security\Authorization\RequestFilter;
+use Neos\Flow\Security\Exception\AccessDeniedException;
use Neos\Flow\Security\RequestPattern\Uri;
use Neos\Flow\Security\RequestPatternResolver;
use Neos\Flow\Tests\UnitTestCase;
@@ -144,10 +145,10 @@ public function allConfiguredFiltersAreCalled()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\AccessDeniedException
*/
public function ifRejectAllIsSetAndNoFilterExplicitlyAllowsTheRequestAPermissionDeniedExceptionIsThrown()
{
+ $this->expectException(AccessDeniedException::class);
$mockActionRequest = $this->getMockBuilder(ActionRequest::class)->disableOriginalConstructor()->getMock();
$mockFilter1 = $this->getMockBuilder(RequestFilter::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.Flow/Tests/Unit/Security/Authorization/InterceptorResolverTest.php b/Neos.Flow/Tests/Unit/Security/Authorization/InterceptorResolverTest.php
index e728338ca8..7860fd3b0c 100644
--- a/Neos.Flow/Tests/Unit/Security/Authorization/InterceptorResolverTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authorization/InterceptorResolverTest.php
@@ -22,10 +22,10 @@ class InterceptorResolverTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\NoInterceptorFoundException
*/
public function resolveInterceptorClassThrowsAnExceptionIfNoInterceptorIsAvailable()
{
+ $this->expectException(Security\Exception\NoInterceptorFoundException::class);
$mockObjectManager = $this->getMockBuilder(ObjectManager::class)->disableOriginalConstructor()->getMock();
$mockObjectManager->expects($this->any())->method('getClassNameByObjectName')->will($this->returnValue(false));
diff --git a/Neos.Flow/Tests/Unit/Security/Authorization/PrivilegeManagerTest.php b/Neos.Flow/Tests/Unit/Security/Authorization/PrivilegeManagerTest.php
index 45a9af1e22..d0fc3dbd4d 100644
--- a/Neos.Flow/Tests/Unit/Security/Authorization/PrivilegeManagerTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Authorization/PrivilegeManagerTest.php
@@ -67,7 +67,7 @@ class PrivilegeManagerTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockSecurityContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
$this->mockObjectManager = $this->getMockBuilder(ObjectManagerInterface::class)->getMock();
diff --git a/Neos.Flow/Tests/Unit/Security/ContextTest.php b/Neos.Flow/Tests/Unit/Security/ContextTest.php
index b50018471a..0b848bc8f0 100644
--- a/Neos.Flow/Tests/Unit/Security/ContextTest.php
+++ b/Neos.Flow/Tests/Unit/Security/ContextTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Exception;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Security\Authentication\AuthenticationManagerInterface;
@@ -61,7 +62,7 @@ class ContextTest extends UnitTestCase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockSessionDataContainer = $this->createMock(SessionDataContainer::class);
@@ -437,11 +438,11 @@ public function authenticationStrategyIsSetCorrectlyFromConfiguration($settings,
}
/**
- * @expectedException \Neos\Flow\Exception
* @test
*/
public function invalidAuthenticationStrategyFromConfigurationThrowsException()
{
+ $this->expectException(Exception::class);
$settings = [];
$settings['security']['authentication']['authenticationStrategy'] = 'fizzleGoesHere';
@@ -482,11 +483,11 @@ public function csrfProtectionStrategyIsSetCorrectlyFromConfiguration($settings,
}
/**
- * @expectedException \Neos\Flow\Exception
* @test
*/
public function invalidCsrfProtectionStrategyFromConfigurationThrowsException()
{
+ $this->expectException(Exception::class);
$settings = [];
$settings['security']['csrf']['csrfStrategy'] = 'fizzleGoesHere';
diff --git a/Neos.Flow/Tests/Unit/Security/Cryptography/HashServiceTest.php b/Neos.Flow/Tests/Unit/Security/Cryptography/HashServiceTest.php
index 524eba2a53..298814d7ce 100644
--- a/Neos.Flow/Tests/Unit/Security/Cryptography/HashServiceTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Cryptography/HashServiceTest.php
@@ -17,6 +17,9 @@
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Security\Cryptography\HashService;
use Neos\Flow\Security\Cryptography\PasswordHashingStrategyInterface;
+use Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException;
+use Neos\Flow\Security\Exception\InvalidHashException;
+use Neos\Flow\Security\Exception\MissingConfigurationException;
use Neos\Flow\Tests\Unit\Cryptography\Fixture\TestHashingStrategy;
use Neos\Flow\Tests\UnitTestCase;
@@ -59,7 +62,7 @@ class HashServiceTest extends UnitTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->cache = new StringFrontend('TestCache', new TransientMemoryBackend(new EnvironmentConfiguration('Hash Testing', '/some/path', PHP_MAXPATHLEN)));
$this->cache->initializeObject();
@@ -102,10 +105,10 @@ public function generateHmacReturnsDifferentHashStringsForDifferentInputStrings(
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException
*/
public function generateHmacThrowsExceptionIfNoStringGiven()
{
+ $this->expectException(InvalidArgumentForHashGenerationException::class);
$this->hashService->generateHmac(null);
}
@@ -170,20 +173,20 @@ public function hashPasswordWillIncludeStrategyIdentifierInHashedPassword()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\MissingConfigurationException
*/
public function hashPasswordThrowsExceptionIfTheGivenHashingStrategyIsNotConfigured()
{
+ $this->expectException(MissingConfigurationException::class);
$this->hashService->hashPassword('myTestPassword', 'nonExistingHashingStrategy');
}
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\MissingConfigurationException
*/
public function hashPasswordThrowsExceptionIfNoDefaultHashingStrategyIsConfigured()
{
+ $this->expectException(MissingConfigurationException::class);
$mockSettings = [
'security' => [
'cryptography' => [
@@ -222,10 +225,10 @@ public function generatedHashReturnsAHashOf40Characters()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException
*/
public function appendHmacThrowsExceptionIfNoStringGiven()
{
+ $this->expectException(InvalidArgumentForHashGenerationException::class);
$this->hashService->appendHmac(null);
}
@@ -241,37 +244,37 @@ public function appendHmacAppendsHmacToGivenString()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException
*/
public function validateAndStripHmacThrowsExceptionIfNoStringGiven()
{
+ $this->expectException(InvalidArgumentForHashGenerationException::class);
$this->hashService->validateAndStripHmac(null);
}
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidArgumentForHashGenerationException
*/
public function validateAndStripHmacThrowsExceptionIfGivenStringIsTooShort()
{
+ $this->expectException(InvalidArgumentForHashGenerationException::class);
$this->hashService->validateAndStripHmac('string with less than 40 characters');
}
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidHashException
*/
public function validateAndStripHmacThrowsExceptionIfGivenStringHasNoHashAppended()
{
+ $this->expectException(InvalidHashException::class);
$this->hashService->validateAndStripHmac('string with exactly a length 40 of chars');
}
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\InvalidHashException
*/
public function validateAndStripHmacThrowsExceptionIfTheAppendedHashIsInvalid()
{
+ $this->expectException(InvalidHashException::class);
$this->hashService->validateAndStripHmac('some Stringac43682075d36592d4cb320e69ff0aa515886eab');
}
diff --git a/Neos.Flow/Tests/Unit/Security/Cryptography/RsaWalletServicePhpTest.php b/Neos.Flow/Tests/Unit/Security/Cryptography/RsaWalletServicePhpTest.php
index c9df2494e7..a8e698c8a7 100644
--- a/Neos.Flow/Tests/Unit/Security/Cryptography/RsaWalletServicePhpTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Cryptography/RsaWalletServicePhpTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Security\Exception\DecryptionNotAllowedException;
use org\bovigo\vfs\vfsStream;
use Neos\Flow\Security\Cryptography\RsaWalletServicePhp;
use Neos\Flow\Tests\UnitTestCase;
@@ -38,7 +39,7 @@ class RsaWalletServicePhpTest extends UnitTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
$settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath'] = 'vfs://Foo/EncryptionKey';
@@ -104,10 +105,10 @@ public function checkRSAEncryptedPasswordReturnsFalseForAnIncorrectPassword()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\DecryptionNotAllowedException
*/
public function decryptingWithAKeypairUUIDMarkedForPasswordUsageThrowsAnException()
{
+ $this->expectException(DecryptionNotAllowedException::class);
$this->keyPairUuid = $this->rsaWalletService->generateNewKeypair(true);
$this->rsaWalletService->decrypt('some cipher', $this->keyPairUuid);
}
diff --git a/Neos.Flow/Tests/Unit/Security/Policy/PolicyExpressionParserTest.php b/Neos.Flow/Tests/Unit/Security/Policy/PolicyExpressionParserTest.php
index 1bdfbb046c..5cc7425522 100644
--- a/Neos.Flow/Tests/Unit/Security/Policy/PolicyExpressionParserTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Policy/PolicyExpressionParserTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Aop\Exception\InvalidPointcutExpressionException;
use Neos\Flow\Security\Authorization\Privilege\Method\MethodTargetExpressionParser;
use Neos\Flow\Tests\UnitTestCase;
@@ -21,10 +22,10 @@ class PolicyExpressionParserTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Aop\Exception\InvalidPointcutExpressionException
*/
public function parseMethodThrowsAnExceptionIfAnotherPrivilegeTargetIsReferencedInAnExpression()
{
+ $this->expectException(InvalidPointcutExpressionException::class);
$parser = $this->getMockBuilder(MethodTargetExpressionParser::class)->setMethods(['parseDesignatorMethod'])->getMock();
$parser->parse('method(TYPO3\TestPackage\BasicClass->setSomeProperty()) || privilegeTarget2', 'FunctionTests');
}
diff --git a/Neos.Flow/Tests/Unit/Security/Policy/PolicyServiceTest.php b/Neos.Flow/Tests/Unit/Security/Policy/PolicyServiceTest.php
index a246fae4bb..7db3e01c42 100644
--- a/Neos.Flow/Tests/Unit/Security/Policy/PolicyServiceTest.php
+++ b/Neos.Flow/Tests/Unit/Security/Policy/PolicyServiceTest.php
@@ -15,6 +15,7 @@
use Neos\Flow\ObjectManagement\ObjectManager;
use Neos\Flow\Security\Authorization\Privilege\AbstractPrivilege;
use Neos\Flow\Security\Authorization\Privilege\PrivilegeTarget;
+use Neos\Flow\Security\Exception\NoSuchRoleException;
use Neos\Flow\Security\Policy\PolicyService;
use Neos\Flow\Security\Policy\Role;
use Neos\Flow\Tests\UnitTestCase;
@@ -49,7 +50,7 @@ class PolicyServiceTest extends UnitTestCase
*/
protected $mockPrivilege;
- public function setUp()
+ protected function setUp(): void
{
$this->policyService = new PolicyService();
@@ -88,10 +89,10 @@ public function hasRoleReturnsTrueIfTheSpecifiedRoleIsConfigured()
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\NoSuchRoleException
*/
public function getRoleThrowsExceptionIfTheSpecifiedRoleIsNotConfigured()
{
+ $this->expectException(NoSuchRoleException::class);
$this->policyService->getRole('Non.Existing:Role');
}
diff --git a/Neos.Flow/Tests/Unit/Security/RequestPattern/CsrfProtectionTest.php b/Neos.Flow/Tests/Unit/Security/RequestPattern/CsrfProtectionTest.php
index c9e55554df..aa909609b3 100644
--- a/Neos.Flow/Tests/Unit/Security/RequestPattern/CsrfProtectionTest.php
+++ b/Neos.Flow/Tests/Unit/Security/RequestPattern/CsrfProtectionTest.php
@@ -41,7 +41,7 @@ class CsrfProtectionTest extends UnitTestCase
*/
protected $mockSystemLogger;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.Flow/Tests/Unit/Security/RequestPatternResolverTest.php b/Neos.Flow/Tests/Unit/Security/RequestPatternResolverTest.php
index 0e5c95fedd..d23b8d3074 100644
--- a/Neos.Flow/Tests/Unit/Security/RequestPatternResolverTest.php
+++ b/Neos.Flow/Tests/Unit/Security/RequestPatternResolverTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\ObjectManagement\ObjectManager;
+use Neos\Flow\Security\Exception\NoRequestPatternFoundException;
use Neos\Flow\Security\RequestPatternResolver;
use Neos\Flow\Tests\UnitTestCase;
@@ -22,10 +23,10 @@ class RequestPatternResolverTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\Flow\Security\Exception\NoRequestPatternFoundException
*/
public function resolveRequestPatternClassThrowsAnExceptionIfNoRequestPatternIsAvailable()
{
+ $this->expectException(NoRequestPatternFoundException::class);
$mockObjectManager = $this->getMockBuilder(ObjectManager::class)->disableOriginalConstructor()->getMock();
$mockObjectManager->expects($this->any())->method('getClassNameByObjectName')->will($this->returnValue(false));
diff --git a/Neos.Flow/Tests/Unit/Session/SessionTest.php b/Neos.Flow/Tests/Unit/Session/SessionTest.php
index ffba9e8329..3f25085a26 100644
--- a/Neos.Flow/Tests/Unit/Session/SessionTest.php
+++ b/Neos.Flow/Tests/Unit/Session/SessionTest.php
@@ -11,6 +11,8 @@
* source code.
*/
+use Neos\Flow\Session\Exception\DataNotSerializableException;
+use Neos\Flow\Session\Exception\OperationNotSupportedException;
use org\bovigo\vfs\vfsStream;
use Neos\Cache\Backend\FileBackend;
use Neos\Cache\EnvironmentConfiguration;
@@ -82,7 +84,7 @@ class SessionTest extends UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setup();
@@ -119,10 +121,10 @@ public function constructCreatesARemoteSessionIfSessionIfIdentifierIsSpecified()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function constructRequiresAStorageIdentifierIfASessionIdentifierWasGiven()
{
+ $this->expectException(\InvalidArgumentException::class);
new Session('ZPjPj3A0Opd7JeDoe7rzUQYCoDMcxscb');
}
@@ -325,10 +327,10 @@ public function renewIdSetsANewSessionIdentifier()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function renewIdThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$this->inject($session, 'settings', $this->settings);
$this->inject($session, 'metaDataCache', $this->createCache('Meta'));
@@ -339,10 +341,10 @@ public function renewIdThrowsExceptionIfCalledOnNonStartedSession()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\OperationNotSupportedException
*/
public function renewIdThrowsExceptionIfCalledOnRemoteSession()
{
+ $this->expectException(OperationNotSupportedException::class);
$storageIdentifier = '6e988eaa-7010-4ee8-bfb8-96ea4b40ec16';
$session = new Session('ZPjPj3A0Opd7JeDoe7rzUQYCoDMcxscb', $storageIdentifier, 1354293259, []);
$this->inject($session, 'settings', $this->settings);
@@ -388,30 +390,30 @@ public function sessionDataCanBeRetrievedEvenAfterSessionIdHasBeenRenewed()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function getDataThrowsExceptionIfSessionIsNotStarted()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->getData('some key');
}
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function putDataThrowsExceptionIfSessionIsNotStarted()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->putData('some key', 'some value');
}
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\DataNotSerializableException
*/
public function putDataThrowsExceptionIfTryingToPersistAResource()
{
+ $this->expectException(DataNotSerializableException::class);
$session = new Session();
$this->inject($session, 'settings', $this->settings);
$this->inject($session, 'metaDataCache', $this->createCache('Meta'));
@@ -444,10 +446,10 @@ public function getDataReturnsDataPreviouslySetWithPutData()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function hasKeyThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->hasKey('foo');
}
@@ -483,10 +485,10 @@ public function twoSessionsDontConflictIfUsingSameEntryIdentifiers()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function getLastActivityTimestampThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->getLastActivityTimestamp();
}
@@ -521,20 +523,20 @@ public function lastActivityTimestampOfNewSessionIsSetAndStoredCorrectlyAndCanBe
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function addTagThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->addTag('MyTag');
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function addTagThrowsExceptionIfTagIsNotValid()
{
+ $this->expectException(\InvalidArgumentException::class);
$taggedSession = new Session();
$this->inject($taggedSession, 'settings', $this->settings);
$this->inject($taggedSession, 'metaDataCache', $this->createCache('Meta'));
@@ -662,20 +664,20 @@ public function getTagsOnAResumedSessionReturnsTheTagsSetWithAddTag()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function getTagsThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->getTags();
}
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function removeTagThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->removeTag('MyTag');
}
@@ -706,10 +708,10 @@ public function removeTagRemovesAPreviouslySetTag()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function touchThrowsExceptionIfCalledOnNonStartedSession()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->touch();
}
@@ -856,10 +858,10 @@ public function shutdownChecksIfSessionStillExistsInStorageCacheBeforeWritingDat
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function destroyThrowsExceptionIfSessionIsNotStarted()
{
+ $this->expectException(SessionNotStartedException::class);
$session = new Session();
$session->destroy();
}
diff --git a/Neos.Flow/Tests/Unit/Session/TransientSessionTest.php b/Neos.Flow/Tests/Unit/Session/TransientSessionTest.php
index cacdb9484c..9d49cd9869 100644
--- a/Neos.Flow/Tests/Unit/Session/TransientSessionTest.php
+++ b/Neos.Flow/Tests/Unit/Session/TransientSessionTest.php
@@ -40,10 +40,10 @@ public function aSessionIdIsGeneratedOnStartingTheSession()
/**
* @test
- * @expectedException \Neos\Flow\Session\Exception\SessionNotStartedException
*/
public function tryingToGetTheSessionIdWithoutStartingTheSessionThrowsAnException()
{
+ $this->expectException(Session\Exception\SessionNotStartedException::class);
$session = new Session\TransientSession();
$session->getId();
}
diff --git a/Neos.Flow/Tests/Unit/SignalSlot/DispatcherTest.php b/Neos.Flow/Tests/Unit/SignalSlot/DispatcherTest.php
index 648689c8f5..2b67ef73d5 100644
--- a/Neos.Flow/Tests/Unit/SignalSlot/DispatcherTest.php
+++ b/Neos.Flow/Tests/Unit/SignalSlot/DispatcherTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\SignalSlot\Dispatcher;
+use Neos\Flow\SignalSlot\Exception\InvalidSlotException;
use Neos\Flow\Tests\UnitTestCase;
/**
@@ -159,10 +160,10 @@ public function dispatchRetrievesSlotInstanceFromTheObjectManagerIfOnlyAClassNam
/**
* @test
- * @expectedException \Neos\Flow\SignalSlot\Exception\InvalidSlotException
*/
public function dispatchThrowsAnExceptionIfTheSpecifiedClassOfASlotIsUnknown()
{
+ $this->expectException(InvalidSlotException::class);
$mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$mockObjectManager->expects($this->once())->method('isRegistered')->with('NonExistingClassName')->will($this->returnValue(false));
@@ -174,10 +175,10 @@ public function dispatchThrowsAnExceptionIfTheSpecifiedClassOfASlotIsUnknown()
/**
* @test
- * @expectedException \Neos\Flow\SignalSlot\Exception\InvalidSlotException
*/
public function dispatchThrowsAnExceptionIfTheSpecifiedSlotMethodDoesNotExist()
{
+ $this->expectException(InvalidSlotException::class);
$slotClassName = 'Mock_' . md5(uniqid(mt_rand(), true));
eval('class ' . $slotClassName . ' { function slot($foo, $baz) { $this->arguments = array($foo, $baz); } }');
$mockSlot = new $slotClassName();
@@ -216,10 +217,10 @@ public function dispatchPassesArgumentContainingSlotInformationLastIfTheConnecti
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function connectWithSignalNameStartingWithEmitShouldNotBeAllowed()
{
+ $this->expectException(\InvalidArgumentException::class);
$mockSignal = $this->getMockBuilder('stdClass')->setMethods(['emitSomeSignal'])->getMock();
$mockSlot = $this->getMockBuilder('stdClass')->setMethods(['someSlotMethod'])->getMock();
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTest.php
index f57459d03e..36646987ee 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Tests\UnitTestCase;
+use Neos\Flow\Validation\Exception\InvalidValidationOptionsException;
use Neos\Flow\Validation\Validator\AbstractValidator;
/**
@@ -21,7 +22,7 @@ class AbstractValidatorTest extends UnitTestCase
{
protected $validator;
- public function setUp()
+ protected function setUp(): void
{
$this->validator = $this->getAccessibleMockForAbstractClass(AbstractValidator::class, [], '', false);
$this->validator->_set('supportedOptions', [
@@ -43,10 +44,10 @@ public function abstractValidatorConstructWithRequiredOptionShouldNotFail()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
*/
public function abstractValidatorConstructWithoutRequiredOptionShouldFail()
{
+ $this->expectException(InvalidValidationOptionsException::class);
$this->validator->__construct([]);
}
}
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTestcase.php b/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTestcase.php
index 0eafb7dcd6..a7eab25c54 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTestcase.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/AbstractValidatorTestcase.php
@@ -27,7 +27,7 @@ abstract class AbstractValidatorTestcase extends UnitTestCase
*/
protected $validator;
- public function setUp()
+ protected function setUp(): void
{
$this->validator = $this->getValidator();
}
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/CollectionValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/CollectionValidatorTest.php
index 8b680118d4..21b58a9e13 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/CollectionValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/CollectionValidatorTest.php
@@ -30,7 +30,7 @@ class CollectionValidatorTest extends AbstractValidatorTestcase
protected $mockValidatorResolver;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->mockValidatorResolver = $this->getMockBuilder(ValidatorResolver::class)->setMethods(['createValidator', 'buildBaseValidatorConjunction'])->getMock();
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/ConjunctionValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/ConjunctionValidatorTest.php
index 12e163f590..c7a09a01cf 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/ConjunctionValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/ConjunctionValidatorTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Tests\UnitTestCase;
+use Neos\Flow\Validation\Exception\NoSuchValidatorException;
use Neos\Flow\Validation\Validator\ConjunctionValidator;
use Neos\Flow\Validation\Validator\ValidatorInterface;
use Neos\Error\Messages as Error;
@@ -115,10 +116,10 @@ public function removingAValidatorOfTheValidatorConjunctionWorks()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\NoSuchValidatorException
*/
public function removingANotExistingValidatorIndexThrowsException()
{
+ $this->expectException(NoSuchValidatorException::class);
$validatorConjunction = new ConjunctionValidator([]);
$validator = $this->createMock(ValidatorInterface::class);
$validatorConjunction->removeValidator($validator);
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeRangeValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeRangeValidatorTest.php
index 060e84adaf..f0526bf686 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeRangeValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeRangeValidatorTest.php
@@ -34,7 +34,7 @@ class DateTimeRangeValidatorTest extends AbstractValidatorTestcase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
$this->accessibleValidator = $this->getAccessibleMock(DateTimeRangeValidator::class, ['dummy']);
}
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeValidatorTest.php
index 21634b189e..a256a891f9 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/DateTimeValidatorTest.php
@@ -34,7 +34,7 @@ class DateTimeValidatorTest extends AbstractValidatorTestcase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->sampleLocale = new Locale('en_GB');
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/NumberValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/NumberValidatorTest.php
index 22c34fc445..06faee2010 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/NumberValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/NumberValidatorTest.php
@@ -35,7 +35,7 @@ class NumberValidatorTest extends AbstractValidatorTestcase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->sampleLocale = new Locale('en_GB');
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/RegularExpressionValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/RegularExpressionValidatorTest.php
index 8ed2006416..ec7d991728 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/RegularExpressionValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/RegularExpressionValidatorTest.php
@@ -27,16 +27,16 @@ class RegularExpressionValidatorTest extends AbstractValidatorTestcase
/**
* Looks empty - and that's the purpose: do not run the parent's setUp().
*/
- public function setUp()
+ protected function setUp(): void
{
}
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
*/
public function validateThrowsExceptionIfExpressionIsEmpty()
{
+ $this->expectException(Validation\Exception\InvalidValidationOptionsException::class);
$this->validatorOptions([]);
$this->validator->validate('foo');
}
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/StringLengthValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/StringLengthValidatorTest.php
index ebd42608c7..d23f0dfc5a 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/StringLengthValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/StringLengthValidatorTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Flow\Validation\Exception\InvalidValidationOptionsException;
use Neos\Flow\Validation\Validator\StringLengthValidator;
require_once('AbstractValidatorTestcase.php');
@@ -136,10 +137,10 @@ public function stringLengthValidatorReturnsNoErrorIfTheStringLengthIsEqualToMin
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
*/
public function stringLengthValidatorThrowsAnExceptionIfMinLengthIsGreaterThanMaxLength()
{
+ $this->expectException(InvalidValidationOptionsException::class);
$this->validator = $this->getMockBuilder(StringLengthValidator::class)->disableOriginalConstructor()->setMethods(['addError'])->getMock();
$this->validatorOptions(['minimum' => 101, 'maximum' => 100]);
$this->validator->validate('1234567890');
diff --git a/Neos.Flow/Tests/Unit/Validation/Validator/UniqueEntityValidatorTest.php b/Neos.Flow/Tests/Unit/Validation/Validator/UniqueEntityValidatorTest.php
index 07c6366e96..9f2aa4d678 100644
--- a/Neos.Flow/Tests/Unit/Validation/Validator/UniqueEntityValidatorTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/Validator/UniqueEntityValidatorTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\Reflection\ClassSchema;
use Neos\Flow\Reflection\ReflectionService;
+use Neos\Flow\Validation\Exception\InvalidValidationOptionsException;
use Neos\Flow\Validation\Validator\UniqueEntityValidator;
/**
@@ -36,7 +37,7 @@ class UniqueEntityValidatorTest extends AbstractValidatorTestcase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->classSchema = $this->getMockBuilder(ClassSchema::class)->disableOriginalConstructor()->getMock();
@@ -48,21 +49,21 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
- * @expectedExceptionCode 1358454270
*/
public function validatorThrowsExceptionIfValueIsNotAnObject()
{
+ $this->expectException(InvalidValidationOptionsException::class);
+ $this->expectExceptionCode(1358454270);
$this->validator->validate('a string');
}
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
- * @expectedExceptionCode 1358454284
*/
public function validatorThrowsExceptionIfValueIsNotReflectedAtAll()
{
+ $this->expectException(InvalidValidationOptionsException::class);
+ $this->expectExceptionCode(1358454284);
$this->classSchema->expects($this->once())->method('getModelType')->will($this->returnValue(null));
$this->validator->validate(new \stdClass());
@@ -70,11 +71,11 @@ public function validatorThrowsExceptionIfValueIsNotReflectedAtAll()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
- * @expectedExceptionCode 1358454284
*/
public function validatorThrowsExceptionIfValueIsNotAFlowEntity()
{
+ $this->expectException(InvalidValidationOptionsException::class);
+ $this->expectExceptionCode(1358454284);
$this->classSchema->expects($this->once())->method('getModelType')->will($this->returnValue(ClassSchema::MODELTYPE_VALUEOBJECT));
$this->validator->validate(new \stdClass());
@@ -82,11 +83,11 @@ public function validatorThrowsExceptionIfValueIsNotAFlowEntity()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
- * @expectedExceptionCode 1358960500
*/
public function validatorThrowsExceptionIfSetupPropertiesAreNotPresentInActualClass()
{
+ $this->expectException(InvalidValidationOptionsException::class);
+ $this->expectExceptionCode(1358960500);
$this->prepareMockExpectations();
$this->inject($this->validator, 'options', ['identityProperties' => ['propertyWhichDoesntExist']]);
$this->classSchema
@@ -100,11 +101,11 @@ public function validatorThrowsExceptionIfSetupPropertiesAreNotPresentInActualCl
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
- * @expectedExceptionCode 1358459831
*/
public function validatorThrowsExceptionIfThereIsNoIdentityProperty()
{
+ $this->expectException(InvalidValidationOptionsException::class);
+ $this->expectExceptionCode(1358459831);
$this->prepareMockExpectations();
$this->classSchema
->expects($this->once())
@@ -116,11 +117,11 @@ public function validatorThrowsExceptionIfThereIsNoIdentityProperty()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationOptionsException
- * @expectedExceptionCode 1358501745
*/
public function validatorThrowsExceptionOnMultipleOrmIdAnnotations()
{
+ $this->expectException(InvalidValidationOptionsException::class);
+ $this->expectExceptionCode(1358501745);
$this->prepareMockExpectations();
$this->classSchema
->expects($this->once())
diff --git a/Neos.Flow/Tests/Unit/Validation/ValidatorResolverTest.php b/Neos.Flow/Tests/Unit/Validation/ValidatorResolverTest.php
index 113c079d1c..3d9c5ce592 100644
--- a/Neos.Flow/Tests/Unit/Validation/ValidatorResolverTest.php
+++ b/Neos.Flow/Tests/Unit/Validation/ValidatorResolverTest.php
@@ -16,6 +16,7 @@
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\Tests\UnitTestCase;
+use Neos\Flow\Validation\Exception\InvalidValidationConfigurationException;
use Neos\Flow\Validation\Validator\CollectionValidator;
use Neos\Flow\Validation\Validator\ConjunctionValidator;
use Neos\Flow\Validation\Validator\DateTimeValidator;
@@ -47,7 +48,7 @@ class ValidatorResolverTest extends UnitTestCase
*/
protected $mockReflectionService;
- public function setUp()
+ protected function setUp(): void
{
$this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$this->mockReflectionService = $this->createMock(ReflectionService::class);
@@ -215,10 +216,10 @@ public function createValidatorReturnsNullIfAValidatorCouldNotBeResolved()
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationConfigurationException
*/
public function createValidatorThrowsExceptionForSingletonValidatorsWithOptions()
{
+ $this->expectException(InvalidValidationConfigurationException::class);
$mockObjectManager = $this->createMock(ObjectManagerInterface::class);
$mockObjectManager->expects($this->once())->method('getScope')->with('FooType')->will($this->returnValue(Configuration::SCOPE_SINGLETON));
@@ -361,10 +362,10 @@ public function buildMethodArgumentsValidatorConjunctionsReturnsEmptyConjunction
/**
* @test
- * @expectedException \Neos\Flow\Validation\Exception\InvalidValidationConfigurationException
*/
public function buildMethodArgumentsValidatorConjunctionsThrowsExceptionIfValidationAnnotationForNonExistingArgumentExists()
{
+ $this->expectException(InvalidValidationConfigurationException::class);
$mockObject = new \stdClass();
$methodParameters = [
diff --git a/Neos.FluidAdaptor/Tests/Functional/Core/WidgetTest.php b/Neos.FluidAdaptor/Tests/Functional/Core/WidgetTest.php
index c806ad5357..16d0bbd545 100644
--- a/Neos.FluidAdaptor/Tests/Functional/Core/WidgetTest.php
+++ b/Neos.FluidAdaptor/Tests/Functional/Core/WidgetTest.php
@@ -21,7 +21,7 @@ class WidgetTest extends \Neos\Flow\Tests\FunctionalTestCase
/**
* Additional setup: Routes
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.FluidAdaptor/Tests/Functional/Form/FormObjectsTest.php b/Neos.FluidAdaptor/Tests/Functional/Form/FormObjectsTest.php
index 0071606067..9f542e823b 100644
--- a/Neos.FluidAdaptor/Tests/Functional/Form/FormObjectsTest.php
+++ b/Neos.FluidAdaptor/Tests/Functional/Form/FormObjectsTest.php
@@ -31,7 +31,7 @@ class FormObjectsTest extends \Neos\Flow\Tests\FunctionalTestCase
/**
* Initializer
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/Neos.FluidAdaptor/Tests/Functional/View/StandaloneViewTest.php b/Neos.FluidAdaptor/Tests/Functional/View/StandaloneViewTest.php
index 70a3b31619..7b0a225cf6 100644
--- a/Neos.FluidAdaptor/Tests/Functional/View/StandaloneViewTest.php
+++ b/Neos.FluidAdaptor/Tests/Functional/View/StandaloneViewTest.php
@@ -16,7 +16,10 @@
use Neos\Flow\Http\Uri;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Tests\FunctionalTestCase;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception\WrongEnctypeException;
use Neos\FluidAdaptor\Tests\Functional\View\Fixtures\View\StandaloneView;
+use Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException;
+use TYPO3Fluid\Fluid\Core\Parser\UnknownNamespaceException;
/**
* Testcase for Standalone View
@@ -79,10 +82,10 @@ public function renderSectionIsEvaluatedCorrectly()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function renderThrowsExceptionIfNeitherTemplateSourceNorTemplatePathAndFilenameAreSpecified()
{
+ $this->expectException(InvalidTemplateResourceException::class);
$httpRequest = Request::create(new Uri('http://localhost'));
$actionRequest = new ActionRequest($httpRequest);
@@ -92,10 +95,10 @@ public function renderThrowsExceptionIfNeitherTemplateSourceNorTemplatePathAndFi
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function renderThrowsExceptionSpecifiedTemplatePathAndFilenameDoesNotExist()
{
+ $this->expectException(InvalidTemplateResourceException::class);
$httpRequest = Request::create(new Uri('http://localhost'));
$actionRequest = new ActionRequest($httpRequest);
@@ -106,10 +109,10 @@ public function renderThrowsExceptionSpecifiedTemplatePathAndFilenameDoesNotExis
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\WrongEnctypeException
*/
public function renderThrowsExceptionIfWrongEnctypeIsSetForFormUpload()
{
+ $this->expectException(WrongEnctypeException::class);
$httpRequest = Request::create(new Uri('http://localhost'));
$actionRequest = new ActionRequest($httpRequest);
@@ -120,10 +123,10 @@ public function renderThrowsExceptionIfWrongEnctypeIsSetForFormUpload()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function renderThrowsExceptionIfSpecifiedTemplatePathAndFilenamePointsToADirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
$request = Request::create(new Uri('http://localhost'));
$actionRequest = new ActionRequest($request);
@@ -249,10 +252,10 @@ public function explicitLayoutPathIsUsed()
/**
* @test
- * @expectedException \TYPO3Fluid\Fluid\Core\Parser\UnknownNamespaceException
*/
public function viewThrowsExceptionWhenUnknownViewHelperIsCalled()
{
+ $this->expectException(UnknownNamespaceException::class);
$httpRequest = Request::create(new Uri('http://localhost'));
$actionRequest = new ActionRequest($httpRequest);
$actionRequest->setFormat('txt');
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractConditionViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractConditionViewHelperTest.php
index dc330b16c1..2356b41b8c 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractConditionViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractConditionViewHelperTest.php
@@ -29,7 +29,7 @@ class AbstractConditionViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(AbstractConditionViewHelper::class, ['getRenderingContext', 'renderChildren', 'hasArgument']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php
index fc6590d9da..42da91c37b 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractTagBasedViewHelperTest.php
@@ -17,7 +17,7 @@
*/
class AbstractTagBasedViewHelperTest extends \Neos\Flow\Tests\UnitTestCase
{
- public function setUp()
+ protected function setUp(): void
{
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\Core\ViewHelper\AbstractTagBasedViewHelper::class, ['dummy'], [], '', false);
}
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
index 339397bf3a..e5b25a37b4 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Mvc\Controller\ControllerContext;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
use Neos\FluidAdaptor\Core\ViewHelper\TemplateVariableContainer;
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
use Neos\FluidAdaptor\View\TemplateView;
@@ -74,7 +75,7 @@ class AbstractViewHelperTest extends \Neos\Flow\Tests\UnitTestCase
]
];
- public function setUp()
+ protected function setUp(): void
{
$this->mockReflectionService = $this->getMockBuilder(\Neos\Flow\Reflection\ReflectionService::class)->disableOriginalConstructor()->getMock();
$this->mockObjectManager = $this->createMock(\Neos\Flow\ObjectManagement\ObjectManagerInterface::class);
@@ -103,10 +104,10 @@ public function argumentsCanBeRegistered()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function registeringTheSameArgumentNameAgainThrowsException()
{
+ $this->expectException(Exception::class);
$viewHelper = $this->getAccessibleMock(AbstractViewHelper::class, ['render'], [], '', false);
$name = 'shortName';
@@ -143,10 +144,10 @@ public function overrideArgumentOverwritesExistingArgumentDefinition()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function overrideArgumentThrowsExceptionWhenTryingToOverwriteAnNonexistingArgument()
{
+ $this->expectException(Exception::class);
$viewHelper = $this->getAccessibleMock(AbstractViewHelper::class, ['render'], [], '', false);
$viewHelper->injectObjectManager($this->mockObjectManager);
@@ -260,10 +261,10 @@ public function validateArgumentsCallsTheRightValidators()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function validateArgumentsCallsTheRightValidatorsAndThrowsExceptionIfValidationIsWrong()
{
+ $this->expectException(\InvalidArgumentException::class);
$viewHelper = $this->getAccessibleMock(AbstractViewHelper::class, ['render', 'prepareArguments'], [], '', false);
$viewHelper->injectObjectManager($this->mockObjectManager);
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetControllerTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetControllerTest.php
index 9133e04526..1f63e49ac6 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetControllerTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetControllerTest.php
@@ -14,6 +14,7 @@
use Neos\Flow\Http\Response;
use Neos\Flow\Http\Uri;
use Neos\Flow\Tests\UnitTestCase;
+use Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException;
use Neos\FluidAdaptor\Core\Widget\WidgetContext;
/**
@@ -23,10 +24,10 @@ class AbstractWidgetControllerTest extends UnitTestCase
{
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException
*/
public function processRequestShouldThrowExceptionIfWidgetContextNotFound()
{
+ $this->expectException(WidgetContextNotFoundException::class);
/** @var \Neos\Flow\Mvc\ActionRequest $mockActionRequest */
$mockActionRequest = $this->createMock(\Neos\Flow\Mvc\ActionRequest::class);
$mockActionRequest->expects($this->atLeastOnce())->method('getInternalArgument')->with('__widgetContext')->will($this->returnValue(null));
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
index 4b08275ba3..06dd512ade 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\Widget\Exception\MissingControllerException;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\TextNode;
@@ -53,7 +54,7 @@ class AbstractWidgetViewHelperTest extends \Neos\Flow\Tests\UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\Core\Widget\AbstractWidgetViewHelper::class, ['validateArguments', 'initialize', 'callRenderMethod', 'getWidgetConfiguration', 'getRenderingContext']);
@@ -152,10 +153,10 @@ public function setChildNodesAddsChildNodesToWidgetContext()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\Widget\Exception\MissingControllerException
*/
public function initiateSubRequestThrowsExceptionIfControllerIsNoWidgetController()
{
+ $this->expectException(MissingControllerException::class);
$controller = $this->createMock(\Neos\Flow\Mvc\Controller\ControllerInterface::class);
$this->viewHelper->_set('controller', $controller);
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetComponentTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetComponentTest.php
index d49a90cb48..7a4b8ea232 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetComponentTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetComponentTest.php
@@ -87,7 +87,7 @@ class AjaxWidgetComponentTest extends UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
$this->ajaxWidgetComponent = new AjaxWidgetComponent();
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetContextHolderTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetContextHolderTest.php
index f972b3490a..04a81b1986 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetContextHolderTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/AjaxWidgetContextHolderTest.php
@@ -11,6 +11,8 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException;
+
/**
* Testcase for AjaxWidgetContextHolder
*
@@ -48,10 +50,10 @@ public function storedWidgetContextCanBeRetrievedAgain()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException
*/
public function getThrowsExceptionIfWidgetContextIsNotFound()
{
+ $this->expectException(WidgetContextNotFoundException::class);
$ajaxWidgetContextHolder = new \Neos\FluidAdaptor\Core\Widget\AjaxWidgetContextHolder();
$ajaxWidgetContextHolder->get(42);
}
diff --git a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/WidgetContextTest.php b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/WidgetContextTest.php
index 8a6f84206b..4e30b84ec1 100644
--- a/Neos.FluidAdaptor/Tests/Unit/Core/Widget/WidgetContextTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/Core/Widget/WidgetContextTest.php
@@ -26,7 +26,7 @@ class WidgetContextTest extends \Neos\Flow\Tests\UnitTestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
$this->widgetContext = new \Neos\FluidAdaptor\Core\Widget\WidgetContext();
}
diff --git a/Neos.FluidAdaptor/Tests/Unit/View/AbstractTemplateViewTest.php b/Neos.FluidAdaptor/Tests/Unit/View/AbstractTemplateViewTest.php
index 913802e789..b059a3cdc1 100644
--- a/Neos.FluidAdaptor/Tests/Unit/View/AbstractTemplateViewTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/View/AbstractTemplateViewTest.php
@@ -45,7 +45,7 @@ class AbstractTemplateViewTest extends \Neos\Flow\Tests\UnitTestCase
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->templateVariableContainer = $this->getMockBuilder(TemplateVariableContainer::class)->setMethods(['exists', 'remove', 'add'])->getMock();
$this->viewHelperVariableContainer = $this->getMockBuilder(ViewHelperVariableContainer::class)->setMethods(['setView'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/View/StandaloneViewTest.php b/Neos.FluidAdaptor/Tests/Unit/View/StandaloneViewTest.php
index 262f991bc3..293de64a21 100644
--- a/Neos.FluidAdaptor/Tests/Unit/View/StandaloneViewTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/View/StandaloneViewTest.php
@@ -12,6 +12,7 @@
*/
+use Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException;
use org\bovigo\vfs\vfsStreamWrapper;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\Controller\ControllerContext;
@@ -38,7 +39,7 @@ class StandaloneViewTest extends UnitTestCase
*/
protected $mockRequest;
- public function setUp()
+ protected function setUp(): void
{
$this->standaloneView = $this->getAccessibleMock(\Neos\FluidAdaptor\View\StandaloneView::class, ['dummy']);
@@ -50,10 +51,10 @@ public function setUp()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getLayoutPathAndFilenameThrowsExceptionIfSpecifiedLayoutRootPathIsNoDirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyLayouts');
\file_put_contents('vfs://MyLayouts/NotAFolder', 'foo');
@@ -63,10 +64,10 @@ public function getLayoutPathAndFilenameThrowsExceptionIfSpecifiedLayoutRootPath
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getLayoutPathAndFilenameThrowsExceptionIfLayoutFileIsADirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyLayouts/NotAFile');
$this->standaloneView->setLayoutRootPath('vfs://MyLayouts');
@@ -75,10 +76,10 @@ public function getLayoutPathAndFilenameThrowsExceptionIfLayoutFileIsADirectory(
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getPartialPathAndFilenameThrowsExceptionIfSpecifiedPartialRootPathIsNoDirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyPartials');
\file_put_contents('vfs://MyPartials/NotAFolder', 'foo');
@@ -88,10 +89,10 @@ public function getPartialPathAndFilenameThrowsExceptionIfSpecifiedPartialRootPa
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getPartialPathAndFilenameThrowsExceptionIfPartialFileIsADirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyPartials/NotAFile');
$this->standaloneView->setPartialRootPath('vfs://MyPartials');
diff --git a/Neos.FluidAdaptor/Tests/Unit/View/TemplatePathsTest.php b/Neos.FluidAdaptor/Tests/Unit/View/TemplatePathsTest.php
index b890ef6a60..810e610bae 100644
--- a/Neos.FluidAdaptor/Tests/Unit/View/TemplatePathsTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/View/TemplatePathsTest.php
@@ -1,6 +1,7 @@
expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
$paths = [
'vfs://NonExistentDir/UnknownFile.html',
@@ -669,10 +670,10 @@ public function getTemplatePathAndFilenameThrowsExceptionIfNoPathCanBeResolved()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getTemplatePathAndFilenameThrowsExceptionIfResolvedPathPointsToADirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyTemplates/NotAFile');
$paths = [
@@ -711,10 +712,10 @@ public function resolveTemplatePathAndFilenameReturnsTheExplicitlyConfiguredTemp
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getLayoutPathAndFilenameThrowsExceptionIfNoPathCanBeResolved()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
$paths = [
'vfs://NonExistentDir/UnknownFile.html',
@@ -738,10 +739,10 @@ public function getLayoutPathAndFilenameThrowsExceptionIfNoPathCanBeResolved()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getLayoutPathAndFilenameThrowsExceptionIfResolvedPathPointsToADirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyTemplates/NotAFile');
$paths = [
@@ -766,10 +767,10 @@ public function getLayoutPathAndFilenameThrowsExceptionIfResolvedPathPointsToADi
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getPartialPathAndFilenameThrowsExceptionIfNoPathCanBeResolved()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
$paths = [
'vfs://NonExistentDir/UnknownFile.html',
@@ -793,10 +794,10 @@ public function getPartialPathAndFilenameThrowsExceptionIfNoPathCanBeResolved()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
*/
public function getPartialPathAndFilenameThrowsExceptionIfResolvedPathPointsToADirectory()
{
+ $this->expectException(InvalidTemplateResourceException::class);
vfsStreamWrapper::register();
mkdir('vfs://MyTemplates/NotAFile');
$paths = [
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php
index 1cd4487ed7..5eb48ce203 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FlashMessagesViewHelperTest.php
@@ -40,7 +40,7 @@ class FlashMessagesViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelp
*
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->mockFlashMessageContainer = $this->createMock(\Neos\Flow\Mvc\FlashMessageContainer::class);
$mockControllerContext = $this->getMockBuilder(\Neos\Flow\Mvc\Controller\ControllerContext::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php
index 24698140ae..e2c0ac15a6 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/ButtonViewHelperTest.php
@@ -25,7 +25,7 @@ class ButtonViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\For
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\ButtonViewHelper::class, ['renderChildren','registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
index 3f22d45d54..209fdbea17 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/CheckboxViewHelperTest.php
@@ -36,7 +36,7 @@ class CheckboxViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\F
*/
protected $mockTagBuilder;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(CheckboxViewHelper::class, ['setErrorClassAttribute', 'getName', 'getValueAttribute', 'isObjectAccessorMode', 'getPropertyValue', 'registerFieldNameForFormTokenGeneration', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
index 0eb50fde65..39008505a1 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
@@ -25,7 +25,7 @@ class HiddenViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\For
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\HiddenViewHelper::class, ['setErrorClassAttribute', 'getName', 'getValueAttribute', 'registerFieldNameForFormTokenGeneration']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.php
index b9fa1594cb..8d9ab1abb2 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.php
@@ -27,7 +27,7 @@ class PasswordViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\F
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\PasswordViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php
index 6a1a9203d3..4c11300e0c 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/RadioViewHelperTest.php
@@ -23,7 +23,7 @@ class RadioViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\Form
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\RadioViewHelper::class, ['setErrorClassAttribute', 'getName', 'getValueAttribute', 'isObjectAccessorMode', 'getPropertyValue', 'registerFieldNameForFormTokenGeneration', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
index fe6a746901..0df15d337e 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
@@ -12,6 +12,7 @@
*/
use Neos\Flow\Persistence\PersistenceManagerInterface;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
require_once(__DIR__ . '/Fixtures/EmptySyntaxTreeNode.php');
@@ -28,7 +29,7 @@ class SelectViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\For
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->arguments['name'] = '';
@@ -378,10 +379,10 @@ public function selectWithoutFurtherConfigurationOnDomainObjectsUsesToStringForL
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function selectOnDomainObjectsThrowsExceptionIfNoValueCanBeFound()
{
+ $this->expectException(Exception::class);
$mockPersistenceManager = $this->createMock(\Neos\Flow\Persistence\PersistenceManagerInterface::class);
$mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValue(null));
$this->viewHelper->injectPersistenceManager($mockPersistenceManager);
@@ -542,10 +543,10 @@ public function translateOptionsAreObserved()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function getTranslatedLabelThrowsExceptionForInvalidLocales()
{
+ $this->expectException(Exception::class);
$this->arguments['translate'] = ['locale' => 'invalid-locale'];
$this->injectDependenciesIntoViewHelper($this->viewHelper);
@@ -554,10 +555,10 @@ public function getTranslatedLabelThrowsExceptionForInvalidLocales()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function getTranslatedLabelThrowsExceptionForUnknownTranslateBy()
{
+ $this->expectException(Exception::class);
$this->arguments['translate'] = ['by' => 'foo'];
$this->injectDependenciesIntoViewHelper($this->viewHelper);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php
index c6504557e6..4b0eef79c6 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php
@@ -23,7 +23,7 @@ class SubmitViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\For
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = new \Neos\FluidAdaptor\ViewHelpers\Form\SubmitViewHelper();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php
index 619d1c7736..ef69ea95b5 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php
@@ -27,7 +27,7 @@ class TextareaViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\F
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\TextareaViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php
index d5d1209052..6cff0c8d57 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php
@@ -27,7 +27,7 @@ class TextfieldViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\TextfieldViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php
index 43795f7836..5480c41fe7 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php
@@ -44,7 +44,7 @@ class UploadViewHelperTest extends FormFieldViewHelperBaseTestcase
*/
protected $mockMappingResult;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(UploadViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration', 'getMappingResultsForProperty']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FormViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FormViewHelperTest.php
index ad2c88bc4e..759d31fe4c 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FormViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/FormViewHelperTest.php
@@ -16,6 +16,7 @@
use Neos\Flow\Security\Context;
use Neos\Flow\Security\Cryptography\HashService;
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
use Neos\FluidAdaptor\ViewHelpers\FormViewHelper;
/**
@@ -46,7 +47,7 @@ class FormViewHelperTest extends ViewHelperBaseTestcase
/**
* Set up test dependencies
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->arguments['action'] = '';
@@ -530,10 +531,10 @@ public function renderResetsFormActionUri()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function renderThrowsExceptionIfNeitherActionNorActionUriArgumentIsSpecified()
{
+ $this->expectException(Exception::class);
$viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, ['renderChildren', 'registerRenderMethodArguments'], [], '', false);
$this->injectDependenciesIntoViewHelper($viewHelper);
$viewHelper = $this->prepareArguments($viewHelper, []);
@@ -542,11 +543,11 @@ public function renderThrowsExceptionIfNeitherActionNorActionUriArgumentIsSpecif
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
- * @expectedExceptionCode 1361354942
*/
public function renderThrowsExceptionIfUseParentRequestIsSetAndTheCurrentRequestHasNoParentRequest()
{
+ $this->expectException(Exception::class);
+ $this->expectExceptionCode(1361354942);
$viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, ['renderChildren', 'registerRenderMethodArguments'], [], '', false);
$this->arguments['useParentRequest'] = true;
$this->arguments['action'] = 'index';
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/BytesViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/BytesViewHelperTest.php
index 517d3bfde6..a607cb7279 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/BytesViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/BytesViewHelperTest.php
@@ -25,7 +25,7 @@ class BytesViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\BytesViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CaseViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CaseViewHelperTest.php
index 1ed7a3faae..55068e0b66 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CaseViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CaseViewHelperTest.php
@@ -14,6 +14,7 @@
require_once(__DIR__ . '/../ViewHelperBaseTestcase.php');
use Neos\FluidAdaptor\Core\Rendering\RenderingContext;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException;
use Neos\FluidAdaptor\ViewHelpers\Format\CaseViewHelper;
use Neos\FluidAdaptor\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
@@ -38,7 +39,7 @@ class CaseViewHelperTest extends ViewHelperBaseTestcase
*/
protected $originalMbEncodingValue;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->renderingContext = $this->getMockBuilder(RenderingContext::class)->disableOriginalConstructor()->getMock();
@@ -50,7 +51,7 @@ public function setUp()
/**
*/
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
mb_internal_encoding($this->originalMbEncodingValue);
@@ -95,10 +96,10 @@ public function viewHelperDoesNotRenderChildrenIfGivenValueIsNotNull($testString
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException
*/
public function viewHelperThrowsExceptionIfIncorrectModeIsGiven()
{
+ $this->expectException(InvalidVariableException::class);
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['value' => 'Foo', 'mode' => 'incorrectMode']);
$this->viewHelper->render('Foo', 'incorrectMode');
}
@@ -116,10 +117,10 @@ public function viewHelperRestoresMbInternalEncodingValueAfterInvocation()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException
*/
public function viewHelperRestoresMbInternalEncodingAfterExceptionOccurred()
{
+ $this->expectException(InvalidVariableException::class);
mb_internal_encoding('ASCII');
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['value' => 'dummy', 'mode' => 'incorrectModeResultingInException']);
$this->viewHelper->render();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CropViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CropViewHelperTest.php
index d58fdb29de..e682ada06a 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CropViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CropViewHelperTest.php
@@ -25,7 +25,7 @@ class CropViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\CropViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CurrencyViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CurrencyViewHelperTest.php
index 5b3f35a82f..684543107d 100755
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CurrencyViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/CurrencyViewHelperTest.php
@@ -14,6 +14,8 @@
require_once(__DIR__ . '/../ViewHelperBaseTestcase.php');
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException;
use Neos\FluidAdaptor\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
/**
@@ -21,7 +23,7 @@
*/
class CurrencyViewHelperTest extends ViewHelperBaseTestcase
{
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\CurrencyViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
@@ -129,10 +131,10 @@ public function viewHelperFetchesCurrentLocaleViaI18nService()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException
*/
public function viewHelperThrowsExceptionIfLocaleIsUsedWithoutExplicitCurrencySign()
{
+ $this->expectException(InvalidVariableException::class);
$localizationConfiguration = new \Neos\Flow\I18n\Configuration('de_DE');
$mockLocalizationService = $this->getMockBuilder(\Neos\Flow\I18n\Service::class)->setMethods(['getConfiguration'])->getMock();
@@ -146,10 +148,10 @@ public function viewHelperThrowsExceptionIfLocaleIsUsedWithoutExplicitCurrencySi
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function viewHelperConvertsI18nExceptionsIntoViewHelperExceptions()
{
+ $this->expectException(Exception::class);
$localizationConfiguration = new \Neos\Flow\I18n\Configuration('de_DE');
$mockLocalizationService = $this->getMockBuilder(\Neos\Flow\I18n\Service::class)->setMethods(['getConfiguration'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
index d409b0db87..968590bc5e 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
use Neos\FluidAdaptor\ViewHelpers\Format;
use Neos\Flow\I18n;
@@ -23,7 +24,7 @@
*/
class DateViewHelperTest extends ViewHelperBaseTestcase
{
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\DateViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
@@ -72,10 +73,10 @@ public function viewHelperReturnsEmptyStringIfNULLIsGiven()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function viewHelperThrowsExceptionIfDateStringCantBeParsed()
{
+ $this->expectException(Exception::class);
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['date' => 'foo']);
$actualResult = $this->viewHelper->render();
}
@@ -104,10 +105,10 @@ public function dateArgumentHasPriorityOverChildNodes()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException
*/
public function viewHelperThrowsExceptionIfInvalidLocaleIdentifierIsGiven()
{
+ $this->expectException(Exception\InvalidVariableException::class);
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['date' => new \DateTime(), 'forceLocale' => '123-not-existing-locale']);
$this->viewHelper->render();
}
@@ -154,10 +155,10 @@ public function viewHelperFetchesCurrentLocaleViaI18nService()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function viewHelperConvertsI18nExceptionsIntoViewHelperExceptions()
{
+ $this->expectException(Exception::class);
$localizationConfiguration = new I18n\Configuration('de_DE');
$mockLocalizationService = $this->getMockBuilder(\Neos\Flow\I18n\Service::class)->setMethods(['getConfiguration'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesDecodeViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesDecodeViewHelperTest.php
index 0d99f91ac2..38234142f9 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesDecodeViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesDecodeViewHelperTest.php
@@ -29,7 +29,7 @@ class HtmlentitiesDecodeViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\HtmlentitiesDecodeViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
@@ -138,10 +138,10 @@ public function renderDecodesObjectsToStrings()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function renderDoesNotModifySourceIfItIsAnObjectThatCantBeConvertedToAString()
{
+ $this->expectException(\InvalidArgumentException::class);
$user = new UserWithoutToString('Xaver Cross-Site');
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['value' => $user]);
$this->viewHelper->render();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesViewHelperTest.php
index 1efa3b7855..86231b3eb2 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/HtmlentitiesViewHelperTest.php
@@ -29,7 +29,7 @@ class HtmlentitiesViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\HtmlentitiesViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
@@ -162,10 +162,10 @@ public function renderConvertsObjectsToStrings()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function renderDoesNotModifySourceIfItIsAnObjectThatCantBeConvertedToAString()
{
+ $this->expectException(\InvalidArgumentException::class);
$user = new UserWithoutToString('Xaver Cross-Site');
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['value' => $user]);
$this->viewHelper->render();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/IdentifierViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/IdentifierViewHelperTest.php
index 3b234949c7..a32a38a378 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/IdentifierViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/IdentifierViewHelperTest.php
@@ -33,7 +33,7 @@ class IdentifierViewHelperTest extends ViewHelperBaseTestcase
/**
* Sets up this test case
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Format\IdentifierViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
@@ -99,10 +99,10 @@ public function renderReturnsNullIfGivenValueIsNull()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function renderThrowsExceptionIfGivenValueIsNoObject()
{
+ $this->expectException(\InvalidArgumentException::class);
$notAnObject = [];
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['value' => $notAnObject]);
$this->viewHelper->render();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/JsonViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/JsonViewHelperTest.php
index 01717fd295..28c92a2dcd 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/JsonViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/JsonViewHelperTest.php
@@ -25,7 +25,7 @@ class JsonViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\JsonViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/Nl2brViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/Nl2brViewHelperTest.php
index ac8f31c647..a2523a14c0 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/Nl2brViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/Nl2brViewHelperTest.php
@@ -25,7 +25,7 @@ class Nl2brViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\Nl2brViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php
index ff18ab4a12..b2ced35a87 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/NumberViewHelperTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
use Neos\FluidAdaptor\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
/**
@@ -24,7 +25,7 @@ class NumberViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\NumberViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
}
@@ -87,10 +88,10 @@ public function viewHelperFetchesCurrentLocaleViaI18nService()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function viewHelperConvertsI18nExceptionsIntoViewHelperExceptions()
{
+ $this->expectException(Exception::class);
$localizationConfiguration = new \Neos\Flow\I18n\Configuration('de_DE');
$mockLocalizationService = $this->getMockBuilder(\Neos\Flow\I18n\Service::class)->setMethods(['getConfiguration'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/PaddingViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/PaddingViewHelperTest.php
index 66703d41a4..0525ed44ec 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/PaddingViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/PaddingViewHelperTest.php
@@ -25,7 +25,7 @@ class PaddingViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\PaddingViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/StripTagsViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/StripTagsViewHelperTest.php
index 2fd4c37644..00120f2e5d 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/StripTagsViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/StripTagsViewHelperTest.php
@@ -29,7 +29,7 @@ class StripTagsViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Format\StripTagsViewHelper::class)->setMethods(['buildRenderChildrenClosure', 'renderChildren', 'registerRenderMethodArguments'])->getMock();
@@ -129,10 +129,10 @@ public function renderConvertsObjectsToStrings()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function renderDoesNotModifySourceIfItIsAnObjectThatCantBeConvertedToAString()
{
+ $this->expectException(\InvalidArgumentException::class);
$user = new UserWithoutToString('Xaver Cross-Site');
$this->viewHelper->expects(self::any())->method('buildRenderChildrenClosure')->willReturn(function () {
throw new \Exception('renderChildrenClosure was invoked but should not have been');
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/UrlencodeViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/UrlencodeViewHelperTest.php
index ad31eb5934..840725227f 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/UrlencodeViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Format/UrlencodeViewHelperTest.php
@@ -27,7 +27,7 @@ class UrlencodeViewHelperTest extends ViewHelperBaseTestcase
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(UrlencodeViewHelper::class)->setMethods(['renderChildren', 'registerRenderMethodArguments'])->getMock();
@@ -89,10 +89,10 @@ public function renderEncodesString()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function renderThrowsExceptionIfItIsNoStringAndHasNoToStringMethod()
{
+ $this->expectException(\InvalidArgumentException::class);
$source = new \stdClass();
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['value' => $source]);
$this->viewHelper->render();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ActionViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ActionViewHelperTest.php
index bf1b671d17..07e7317dc6 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ActionViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ActionViewHelperTest.php
@@ -11,6 +11,8 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
+
require_once(__DIR__ . '/../ViewHelperBaseTestcase.php');
/**
@@ -22,7 +24,7 @@ class ActionViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\Vie
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Link\ActionViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
@@ -96,10 +98,10 @@ public function renderThrowsViewHelperExceptionIfUriBuilderThrowsFlowException()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function renderThrowsExceptionIfUseParentRequestIsSetAndTheCurrentRequestHasNoParentRequest()
{
+ $this->expectException(Exception::class);
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['action' => 'someAction', 'arguments' => [], 'controller' => null, 'package' => null, 'subpackage' => null, 'section' => '', 'format' => '', 'additionalParams' => [], 'addQueryString' => false, 'argumentsToBeExcludedFromQueryString' => [], 'useParentRequest' => true]);
$this->viewHelper->render();
}
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php
index f99faa0f03..d870d4fc7e 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php
@@ -22,7 +22,7 @@ class EmailViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\View
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Link\EmailViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php
index bee14ed90a..f3f188b801 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php
@@ -25,7 +25,7 @@ class ExternalViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\V
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Link\ExternalViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/RenderChildrenViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/RenderChildrenViewHelperTest.php
index f7be82278f..839802092a 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/RenderChildrenViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/RenderChildrenViewHelperTest.php
@@ -11,6 +11,8 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\Widget\Exception\RenderingContextNotFoundException;
+use Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
@@ -29,7 +31,7 @@ class RenderChildrenViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHel
/**
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\RenderChildrenViewHelper::class)->setMethods(['renderChildren'])->getMock();
@@ -67,10 +69,10 @@ public function renderCallsEvaluateOnTheRootNodeAndRegistersTheArguments()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException
*/
public function renderThrowsExceptionIfTheRequestIsNotAWidgetRequest()
{
+ $this->expectException(WidgetContextNotFoundException::class);
$this->injectDependenciesIntoViewHelper($this->viewHelper);
$this->viewHelper->initializeArguments();
@@ -79,10 +81,10 @@ public function renderThrowsExceptionIfTheRequestIsNotAWidgetRequest()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\Widget\Exception\RenderingContextNotFoundException
*/
public function renderThrowsExceptionIfTheChildNodeRenderingContextIsNotThere()
{
+ $this->expectException(RenderingContextNotFoundException::class);
$this->injectDependenciesIntoViewHelper($this->viewHelper);
$this->viewHelper->initializeArguments();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/CsrfTokenViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/CsrfTokenViewHelperTest.php
index bf56e78682..c207058616 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/CsrfTokenViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/CsrfTokenViewHelperTest.php
@@ -33,7 +33,7 @@ class CsrfTokenViewHelperTest extends ViewHelperBaseTestcase
/**
*
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(CsrfTokenViewHelper::class)->setMethods(['buildRenderChildrenClosure'])->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfAccessViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfAccessViewHelperTest.php
index 136f8d4a1e..e542a3c4a5 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfAccessViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfAccessViewHelperTest.php
@@ -33,7 +33,7 @@ class IfAccessViewHelperTest extends ViewHelperBaseTestcase
*/
protected $mockPrivilegeManager;
- public function setUp()
+ protected function setUp(): void
{
$this->mockPrivilegeManager = $this->getMockBuilder(\Neos\Flow\Security\Authorization\PrivilegeManagerInterface::class)->disableOriginalConstructor()->getMock();
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfHasRoleViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfHasRoleViewHelperTest.php
index aab621b7ea..0f6d8539ab 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfHasRoleViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Security/IfHasRoleViewHelperTest.php
@@ -43,7 +43,7 @@ class IfHasRoleViewHelperTest extends ViewHelperBaseTestcase
*/
protected $mockPolicyService;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->mockViewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Security\IfHasRoleViewHelper::class)->setMethods([
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/TranslateViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/TranslateViewHelperTest.php
index 8391a4e03d..3c03c07434 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/TranslateViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/TranslateViewHelperTest.php
@@ -13,6 +13,7 @@
use Neos\Flow\I18n\Locale;
use Neos\Flow\I18n\Translator;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
use Neos\FluidAdaptor\ViewHelpers\TranslateViewHelper;
require_once(__DIR__ . '/ViewHelperBaseTestcase.php');
@@ -37,7 +38,7 @@ class TranslateViewHelperTest extends ViewHelperBaseTestcase
*/
protected $mockTranslator;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -118,20 +119,20 @@ public function viewHelperReturnsIdWhenRenderChildrenReturnsEmptyResultIfIdIsNot
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function renderThrowsExceptionIfGivenLocaleIdentifierIsInvalid()
{
+ $this->expectException(Exception::class);
$this->translateViewHelper = $this->prepareArguments($this->translateViewHelper, ['id' => 'some.label', 'value' => null, 'arguments' => [], 'source' => 'Main', 'package' => null, 'quantity' => null, 'locale' => 'INVALIDLOCALE']);
$this->translateViewHelper->render();
}
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function renderThrowsExceptionIfNoPackageCouldBeResolved()
{
+ $this->expectException(Exception::class);
$mockRequest = $this->getMockBuilder(\Neos\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
$mockRequest->expects($this->any())->method('getControllerPackageKey')->will($this->returnValue(null));
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ActionViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ActionViewHelperTest.php
index ad1604eab5..fb70df8fd2 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ActionViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ActionViewHelperTest.php
@@ -11,6 +11,8 @@
* source code.
*/
+use Neos\FluidAdaptor\Core\ViewHelper\Exception;
+
require_once(__DIR__ . '/../ViewHelperBaseTestcase.php');
/**
@@ -24,7 +26,7 @@ class ActionViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\Vie
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Uri\ActionViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
@@ -95,10 +97,10 @@ public function renderThrowsViewHelperExceptionIfUriBuilderThrowsFlowException()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception
*/
public function renderThrowsExceptionIfUseParentRequestIsSetAndTheCurrentRequestHasNoParentRequest()
{
+ $this->expectException(Exception::class);
$this->viewHelper = $this->prepareArguments($this->viewHelper, ['action' => 'someAction', 'arguments' => [], 'controller' => null, 'package' => null, 'subpackage' => null, 'section' => '', 'format' => '', 'additionalParams' => [], 'absolute' => false, 'addQueryString' => false, 'argumentsToBeExcludedFromQueryString' => [], 'useParentRequest' => true]);
$this->viewHelper->render();
}
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/EmailViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/EmailViewHelperTest.php
index e7dbd769d1..46e46fbc11 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/EmailViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/EmailViewHelperTest.php
@@ -23,7 +23,7 @@ class EmailViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\View
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Uri\EmailViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ExternalViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ExternalViewHelperTest.php
index 7e6ca7516f..0c46e174de 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ExternalViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ExternalViewHelperTest.php
@@ -24,7 +24,7 @@ class ExternalViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\V
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Uri\ExternalViewHelper::class, ['renderChildren', 'registerRenderMethodArguments']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ResourceViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ResourceViewHelperTest.php
index 755c056269..9b7ab5415a 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ResourceViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Uri/ResourceViewHelperTest.php
@@ -17,6 +17,7 @@
use Neos\Flow\ResourceManagement\Exception;
use Neos\Flow\ResourceManagement\PersistentResource;
use Neos\Flow\ResourceManagement\ResourceManager;
+use Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException;
use Neos\FluidAdaptor\ViewHelpers\Uri\ResourceViewHelper;
require_once(__DIR__ . '/../ViewHelperBaseTestcase.php');
@@ -46,7 +47,7 @@ class ResourceViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\V
*/
protected $mockResourceManager;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->mockI18nService = $this->createMock(Service::class);
@@ -201,10 +202,10 @@ public function renderSkipsLocalizationForResourcesGivenAsResourceUriIfRequested
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException
*/
public function renderThrowsExceptionIfNeitherResourceNorPathWereGiven()
{
+ $this->expectException(InvalidVariableException::class);
$this->viewHelper = $this->prepareArguments($this->viewHelper, [
'path' => null,
'package' => 'SomePackage',
@@ -215,10 +216,10 @@ public function renderThrowsExceptionIfNeitherResourceNorPathWereGiven()
/**
* @test
- * @expectedException \Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException
*/
public function renderThrowsExceptionIfResourceUriNotPointingToPublicWasGivenAsPath()
{
+ $this->expectException(InvalidVariableException::class);
$this->mockResourceManager
->expects($this->once())
->method('getPackageAndPathByPublicPath')
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/IfHasErrorsViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/IfHasErrorsViewHelperTest.php
index 3790261365..522708310e 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/IfHasErrorsViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/IfHasErrorsViewHelperTest.php
@@ -29,7 +29,7 @@ class IfHasErrorsViewHelperTest extends ViewHelperBaseTestcase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Validation\IfHasErrorsViewHelper::class, ['renderThenChild', 'renderElseChild']);
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/ResultsViewHelperTest.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/ResultsViewHelperTest.php
index ba2bfd6e69..e95449ce33 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/ResultsViewHelperTest.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/Validation/ResultsViewHelperTest.php
@@ -24,7 +24,7 @@ class ResultsViewHelperTest extends \Neos\FluidAdaptor\Tests\Unit\ViewHelpers\Vi
*/
protected $viewHelper;
- public function setUp()
+ protected function setUp(): void
{
parent::setUp();
$this->viewHelper = $this->getMockBuilder(\Neos\FluidAdaptor\ViewHelpers\Validation\ResultsViewHelper::class)
diff --git a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php
index 378768e72f..eeeae22c03 100644
--- a/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php
+++ b/Neos.FluidAdaptor/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php
@@ -75,7 +75,7 @@ abstract class ViewHelperBaseTestcase extends \Neos\Flow\Tests\UnitTestCase
/**
* @return void
*/
- public function setUp()
+ protected function setUp(): void
{
$this->viewHelperVariableContainer = $this->createMock(\TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
$this->viewHelperVariableContainer->expects($this->any())->method('exists')->will($this->returnCallback([$this, 'viewHelperVariableContainerExistsCallback']));
diff --git a/Neos.Utility.Arrays/Tests/Unit/ArraysTest.php b/Neos.Utility.Arrays/Tests/Unit/ArraysTest.php
index b38e948997..05bef120d5 100644
--- a/Neos.Utility.Arrays/Tests/Unit/ArraysTest.php
+++ b/Neos.Utility.Arrays/Tests/Unit/ArraysTest.php
@@ -82,10 +82,10 @@ public function getValueByPathReturnsTheValueOfANestedArrayByFollowingTheGivenPa
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function getValueByPathThrowsExceptionIfPathIsNoArrayOrString()
{
+ $this->expectException(\InvalidArgumentException::class);
$array = ['Foo' => ['Bar' => ['Baz' => [2 => 'the value']]]];
Arrays::getValueByPath($array, null);
}
@@ -174,30 +174,30 @@ public function setValueByPathRecursivelyMergesAnArray()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setValueByPathThrowsExceptionIfPathIsNoArrayOrString()
{
+ $this->expectException(\InvalidArgumentException::class);
$array = ['Foo' => ['Bar' => ['Baz' => [2 => 'the value']]]];
Arrays::setValueByPath($array, null, 'Some Value');
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setValueByPathThrowsExceptionIfSubjectIsNoArray()
{
+ $this->expectException(\InvalidArgumentException::class);
$subject = 'foobar';
Arrays::setValueByPath($subject, 'foo', 'bar');
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setValueByPathThrowsExceptionIfSubjectIsNoArrayAccess()
{
+ $this->expectException(\InvalidArgumentException::class);
$subject = new \stdClass();
Arrays::setValueByPath($subject, 'foo', 'bar');
}
@@ -265,10 +265,10 @@ public function unsetValueByPathRemovesSpecifiedBranch()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function unsetValueByPathThrowsExceptionIfPathIsNoArrayOrString()
{
+ $this->expectException(\InvalidArgumentException::class);
$array = ['Foo' => ['Bar' => ['Baz' => [2 => 'the value']]]];
Arrays::unsetValueByPath($array, null);
}
diff --git a/Neos.Utility.Arrays/Tests/Unit/PositionalArraySorterTest.php b/Neos.Utility.Arrays/Tests/Unit/PositionalArraySorterTest.php
index b5248780f9..162f8b3cef 100644
--- a/Neos.Utility.Arrays/Tests/Unit/PositionalArraySorterTest.php
+++ b/Neos.Utility.Arrays/Tests/Unit/PositionalArraySorterTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Utility\Exception\InvalidPositionException;
use Neos\Utility\PositionalArraySorter;
/**
@@ -49,10 +50,10 @@ public function invalidPositions()
* @dataProvider invalidPositions
*
* @param array $subject
- * @expectedException \Neos\Utility\Exception\InvalidPositionException
*/
public function toArrayThrowsExceptionForInvalidPositions(array $subject)
{
+ $this->expectException(InvalidPositionException::class);
$positionalArraySorter = new PositionalArraySorter($subject);
$positionalArraySorter->toArray();
}
diff --git a/Neos.Utility.Arrays/composer.json b/Neos.Utility.Arrays/composer.json
index 25ddc6e55b..d2c42f74cc 100644
--- a/Neos.Utility.Arrays/composer.json
+++ b/Neos.Utility.Arrays/composer.json
@@ -10,7 +10,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Utility.Files/Tests/Unit/FilesTest.php b/Neos.Utility.Files/Tests/Unit/FilesTest.php
index ca14191be6..dd13185e2a 100644
--- a/Neos.Utility.Files/Tests/Unit/FilesTest.php
+++ b/Neos.Utility.Files/Tests/Unit/FilesTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Utility\Exception\FilesException;
use org\bovigo\vfs\vfsStream;
use Neos\Utility\Files;
@@ -24,7 +25,7 @@ class FilesTest extends \PHPUnit\Framework\TestCase
*/
protected $temporaryDirectory;
- public function setUp()
+ protected function setUp(): void
{
vfsStream::setup('Foo');
@@ -35,7 +36,7 @@ public function setUp()
$this->temporaryDirectory = realpath($intendedTemporaryDirectory);
}
- public function tearDown()
+ protected function tearDown(): void
{
Files::removeDirectoryRecursively($this->temporaryDirectory);
}
@@ -266,19 +267,19 @@ public function is_linkReturnsFalseForStreamWrapperPaths()
/**
* @test
- * @expectedException \Neos\Utility\Exception\FilesException
*/
public function emptyDirectoryRecursivelyThrowsExceptionIfSpecifiedPathDoesNotExist()
{
+ $this->expectException(FilesException::class);
Files::emptyDirectoryRecursively('NonExistingPath');
}
/**
* @test
- * @expectedException \Neos\Utility\Exception\FilesException
*/
public function removeDirectoryRecursivelyThrowsExceptionIfSpecifiedPathDoesNotExist()
{
+ $this->expectException(FilesException::class);
Files::removeDirectoryRecursively('NonExistingPath');
}
@@ -346,10 +347,10 @@ public function removeEmptyDirectoriesOnPathRemovesOnlyDirectoriesBelowTheGivenB
/**
* @test
- * @expectedException \Neos\Utility\Exception\FilesException
*/
public function removeEmptyDirectoriesOnPathThrowsExceptionIfBasePathIsNotParentOfPath()
{
+ $this->expectException(FilesException::class);
Files::createDirectoryRecursively('vfs://Foo/Bar/Baz/Quux');
Files::removeEmptyDirectoriesOnPath('vfs://Foo/Bar/Baz/Quux', 'vfs://Other/Bar');
}
@@ -654,10 +655,10 @@ public function sizeStringToBytesTests($sizeString, $expected)
/**
* @test
- * @expectedException \Neos\Utility\Exception\FilesException
*/
public function sizeStringThrowsExceptionIfTheSpecifiedUnitIsUnknown()
{
+ $this->expectException(FilesException::class);
Files::sizeStringToBytes('123 UnknownUnit');
}
}
diff --git a/Neos.Utility.Files/composer.json b/Neos.Utility.Files/composer.json
index f492558b23..f20d3a0268 100644
--- a/Neos.Utility.Files/composer.json
+++ b/Neos.Utility.Files/composer.json
@@ -10,7 +10,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Utility.Lock/Tests/Unit/LockTest.php b/Neos.Utility.Lock/Tests/Unit/LockTest.php
index ddff0ff9a2..00384f41c4 100644
--- a/Neos.Utility.Lock/Tests/Unit/LockTest.php
+++ b/Neos.Utility.Lock/Tests/Unit/LockTest.php
@@ -27,7 +27,7 @@ class LockTest extends \PHPUnit\Framework\TestCase
*/
protected $lockFileName;
- public static function setUpBeforeClass()
+ public static function setUpBeforeClass(): void
{
vfsStream::setup('Lock');
@@ -37,14 +37,14 @@ public static function setUpBeforeClass()
Lock::setLockManager($lockManager);
}
- public function setUp()
+ protected function setUp(): void
{
$lock = new Lock('testLock');
$this->lockFileName = $lock->getLockStrategy()->getLockFileName();
$lock->release();
}
- public static function tearDownAfterClass()
+ public static function tearDownAfterClass(): void
{
Lock::setLockManager(null);
}
diff --git a/Neos.Utility.Lock/composer.json b/Neos.Utility.Lock/composer.json
index eddcd1229c..bddb70839c 100644
--- a/Neos.Utility.Lock/composer.json
+++ b/Neos.Utility.Lock/composer.json
@@ -11,7 +11,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Utility.MediaTypes/composer.json b/Neos.Utility.MediaTypes/composer.json
index 0a263ead69..5eee9bb11c 100644
--- a/Neos.Utility.MediaTypes/composer.json
+++ b/Neos.Utility.MediaTypes/composer.json
@@ -9,7 +9,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1",
+ "phpunit/phpunit": "~8.1",
"neos/flow": "*"
},
"autoload": {
diff --git a/Neos.Utility.ObjectHandling/Tests/Unit/ObjectAccessTest.php b/Neos.Utility.ObjectHandling/Tests/Unit/ObjectAccessTest.php
index f562599480..68511eaa64 100644
--- a/Neos.Utility.ObjectHandling/Tests/Unit/ObjectAccessTest.php
+++ b/Neos.Utility.ObjectHandling/Tests/Unit/ObjectAccessTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Utility\Exception\PropertyNotAccessibleException;
use Neos\Utility\ObjectHandling\Tests\Unit\Fixture\DummyClassWithGettersAndSetters;
use Neos\Utility\ObjectHandling\Tests\Unit\Fixture\Model\EntityWithDoctrineProxy;
use Neos\Utility\ObjectHandling\Tests\Unit\Fixture\ArrayAccessClass;
@@ -33,7 +34,7 @@ class ObjectAccessTest extends \PHPUnit\Framework\TestCase
/**
*/
- public function setUp()
+ protected function setUp(): void
{
$this->dummyObject = new DummyClassWithGettersAndSetters();
$this->dummyObject->setProperty('string1');
@@ -80,28 +81,28 @@ public function getPropertyReturnsExpectedValueForUnknownPropertyIfForceDirectAc
/**
* @test
- * @expectedException \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function getPropertyReturnsPropertyNotAccessibleExceptionForNotExistingPropertyIfForceDirectAccessIsTrue()
{
+ $this->expectException(PropertyNotAccessibleException::class);
ObjectAccess::getProperty($this->dummyObject, 'notExistingProperty', true);
}
/**
* @test
- * @expectedException \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function getPropertyReturnsThrowsExceptionIfPropertyDoesNotExist()
{
+ $this->expectException(PropertyNotAccessibleException::class);
ObjectAccess::getProperty($this->dummyObject, 'notExistingProperty');
}
/**
* @test
- * @expectedException \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function getPropertyReturnsThrowsExceptionIfArrayKeyDoesNotExist()
{
+ $this->expectException(PropertyNotAccessibleException::class);
ObjectAccess::getProperty([], 'notExistingProperty');
}
@@ -129,19 +130,19 @@ public function getPropertyTriesToCallABooleanHasGetterMethodIfItExists()
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function getPropertyThrowsExceptionIfThePropertyNameIsNotAString()
{
+ $this->expectException(\InvalidArgumentException::class);
ObjectAccess::getProperty($this->dummyObject, new \ArrayObject());
}
/**
* @test
- * @expectedException \InvalidArgumentException
*/
public function setPropertyThrowsExceptionIfThePropertyNameIsNotAString()
{
+ $this->expectException(\InvalidArgumentException::class);
ObjectAccess::setProperty($this->dummyObject, new \ArrayObject(), 42);
}
@@ -249,20 +250,20 @@ public function getPropertyCallsGettersBeforeCheckingViaArrayAccess()
/**
* @test
- * @expectedException \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function getPropertyThrowsExceptionIfArrayObjectDoesNotContainMatchingKeyNorGetter()
{
+ $this->expectException(PropertyNotAccessibleException::class);
$arrayObject = new \ArrayObject();
ObjectAccess::getProperty($arrayObject, 'nonExistingProperty');
}
/**
* @test
- * @expectedException \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function getPropertyDoesNotTryArrayAccessOnSplObjectStorageSubject()
{
+ $this->expectException(PropertyNotAccessibleException::class);
$splObjectStorage = new \SplObjectStorage();
ObjectAccess::getProperty($splObjectStorage, 'something');
}
@@ -523,10 +524,10 @@ public function getPropertyPathReturnsNullIfSubjectOnPathIsNoObject()
/**
* @test
- * @expectedException \Neos\Utility\Exception\PropertyNotAccessibleException
*/
public function accessorCacheIsNotUsedForStdClass()
{
+ $this->expectException(PropertyNotAccessibleException::class);
$object1 = new \stdClass();
$object1->property = 'booh!';
$object2 = new \stdClass();
diff --git a/Neos.Utility.ObjectHandling/Tests/Unit/TypeHandlingTest.php b/Neos.Utility.ObjectHandling/Tests/Unit/TypeHandlingTest.php
index 13a47448ef..e9437f8423 100644
--- a/Neos.Utility.ObjectHandling/Tests/Unit/TypeHandlingTest.php
+++ b/Neos.Utility.ObjectHandling/Tests/Unit/TypeHandlingTest.php
@@ -11,6 +11,7 @@
* source code.
*/
+use Neos\Utility\Exception\InvalidTypeException;
use Neos\Utility\TypeHandling;
/**
@@ -20,19 +21,19 @@ class TypeHandlingTest extends \PHPUnit\Framework\TestCase
{
/**
* @test
- * @expectedException \Neos\Utility\Exception\InvalidTypeException
*/
public function parseTypeThrowsExceptionOnInvalidType()
{
+ $this->expectException(InvalidTypeException::class);
TypeHandling::parseType('$something');
}
/**
* @test
- * @expectedException \Neos\Utility\Exception\InvalidTypeException
*/
public function parseTypeThrowsExceptionOnInvalidElementTypeHint()
{
+ $this->expectException(InvalidTypeException::class);
TypeHandling::parseType('string');
}
diff --git a/Neos.Utility.ObjectHandling/composer.json b/Neos.Utility.ObjectHandling/composer.json
index 8c2fd81394..947674e021 100644
--- a/Neos.Utility.ObjectHandling/composer.json
+++ b/Neos.Utility.ObjectHandling/composer.json
@@ -8,7 +8,7 @@
"php": "~7.1"
},
"require-dev": {
- "phpunit/phpunit": "~7.1",
+ "phpunit/phpunit": "~8.1",
"doctrine/orm": "~2.6.0",
"doctrine/common": ">=2.4,<2.8-dev"
},
diff --git a/Neos.Utility.Schema/Tests/Unit/SchemaGeneratorTest.php b/Neos.Utility.Schema/Tests/Unit/SchemaGeneratorTest.php
index e4f10cb2e1..866d19c994 100644
--- a/Neos.Utility.Schema/Tests/Unit/SchemaGeneratorTest.php
+++ b/Neos.Utility.Schema/Tests/Unit/SchemaGeneratorTest.php
@@ -23,7 +23,7 @@ class SchemaGeneratorTest extends \PHPUnit\Framework\TestCase
*/
private $configurationGenerator;
- public function setUp()
+ protected function setUp(): void
{
$this->configurationGenerator = new SchemaGenerator();
}
diff --git a/Neos.Utility.Schema/Tests/Unit/SchemaValidatorTest.php b/Neos.Utility.Schema/Tests/Unit/SchemaValidatorTest.php
index ec8b50a865..b71c955388 100644
--- a/Neos.Utility.Schema/Tests/Unit/SchemaValidatorTest.php
+++ b/Neos.Utility.Schema/Tests/Unit/SchemaValidatorTest.php
@@ -24,7 +24,7 @@ class SchemaValidatorTest extends \PHPUnit\Framework\TestCase
*/
protected $configurationValidator;
- public function setUp()
+ protected function setUp(): void
{
$this->configurationValidator = $this->getMockBuilder(SchemaValidator::class)->setMethods(['getError'])->getMock();
}
diff --git a/Neos.Utility.Schema/composer.json b/Neos.Utility.Schema/composer.json
index e02ca539bc..d8ea3065e5 100644
--- a/Neos.Utility.Schema/composer.json
+++ b/Neos.Utility.Schema/composer.json
@@ -10,7 +10,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/Neos.Utility.Unicode/Tests/Unit/TextIteratorTest.php b/Neos.Utility.Unicode/Tests/Unit/TextIteratorTest.php
index 28dc1f8f95..3482596965 100644
--- a/Neos.Utility.Unicode/Tests/Unit/TextIteratorTest.php
+++ b/Neos.Utility.Unicode/Tests/Unit/TextIteratorTest.php
@@ -87,7 +87,7 @@ public function instantiatingIteratorWithInvalidTypeThrowsError()
new TextIterator('Some string', 948);
$this->fail('Constructor did not reject invalid TextIterator type.');
} catch (Unicode\Exception $exception) {
- $this->assertContains('Invalid iterator type in TextIterator constructor', $exception->getMessage(), 'Wrong error message.');
+ $this->assertStringContainsString('Invalid iterator type in TextIterator constructor', $exception->getMessage(), 'Wrong error message.');
}
}
diff --git a/Neos.Utility.Unicode/composer.json b/Neos.Utility.Unicode/composer.json
index 73579edbf4..e092687706 100644
--- a/Neos.Utility.Unicode/composer.json
+++ b/Neos.Utility.Unicode/composer.json
@@ -13,7 +13,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1"
+ "phpunit/phpunit": "~8.1"
},
"autoload": {
"psr-4": {
diff --git a/composer.json b/composer.json
index e2eeff05da..cda894d9e4 100644
--- a/composer.json
+++ b/composer.json
@@ -110,7 +110,7 @@
},
"require-dev": {
"mikey179/vfsstream": "~1.6",
- "phpunit/phpunit": "~7.1",
+ "phpunit/phpunit": "~8.1",
"neos/flow": "*",
"doctrine/orm": "~2.6.0",
"doctrine/common": ">=2.4,<2.8-dev"