summaryrefslogtreecommitdiff
path: root/tests/Unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit')
-rw-r--r--tests/Unit/ApplicationTest.php6
-rw-r--r--tests/Unit/Database/Migration/MigrateTest.php4
-rw-r--r--tests/Unit/Exceptions/HandlerTest.php4
-rw-r--r--tests/Unit/Helpers/AuthenticatorTest.php4
-rw-r--r--tests/Unit/Helpers/Translation/TranslatorTest.php8
-rw-r--r--tests/Unit/Http/RequestServiceProviderTest.php2
-rw-r--r--tests/Unit/Http/RequestTest.php6
-rw-r--r--tests/Unit/Http/SessionServiceProviderTest.php6
-rw-r--r--tests/Unit/Mail/Transport/LogTransportTest.php2
-rw-r--r--tests/Unit/Mail/Transport/TransportTest.php2
-rw-r--r--tests/Unit/Middleware/CallableHandlerTest.php2
-rw-r--r--tests/Unit/Middleware/DispatcherTest.php4
-rw-r--r--tests/Unit/Middleware/ErrorHandlerTest.php2
-rw-r--r--tests/Unit/Middleware/LegacyMiddlewareTest.php2
-rw-r--r--tests/Unit/Middleware/RequestHandlerTest.php6
-rw-r--r--tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php2
-rw-r--r--tests/Unit/Middleware/SendResponseHandlerTest.php2
-rw-r--r--tests/Unit/Middleware/SessionHandlerTest.php2
-rw-r--r--tests/Unit/Middleware/VerifyCsrfTokenTest.php4
-rw-r--r--tests/Unit/Renderer/Twig/Extensions/CsrfTest.php2
-rw-r--r--tests/Unit/Renderer/TwigServiceProviderTest.php4
-rw-r--r--tests/Unit/ServiceProviderTest.php2
22 files changed, 39 insertions, 39 deletions
diff --git a/tests/Unit/ApplicationTest.php b/tests/Unit/ApplicationTest.php
index e466ecd7..a36610cb 100644
--- a/tests/Unit/ApplicationTest.php
+++ b/tests/Unit/ApplicationTest.php
@@ -113,7 +113,7 @@ class ApplicationTest extends TestCase
$mockClassName = $this->getMockClass(ServiceProvider::class);
$serviceProvider = $this->getMockBuilder($mockClassName)
->setConstructorArgs([$app])
- ->setMethods(['register'])
+ ->onlyMethods(['register'])
->getMock();
$serviceProvider->expects($this->once())
@@ -132,7 +132,7 @@ class ApplicationTest extends TestCase
{
/** @var Application|MockObject $app */
$app = $this->getMockBuilder(Application::class)
- ->setMethods(['register'])
+ ->onlyMethods(['register'])
->getMock();
$serviceProvider = $this->mockServiceProvider($app, ['boot']);
@@ -175,7 +175,7 @@ class ApplicationTest extends TestCase
{
$serviceProvider = $this->getMockBuilder(ServiceProvider::class)
->setConstructorArgs([$app])
- ->setMethods($methods)
+ ->onlyMethods($methods)
->getMockForAbstractClass();
return $serviceProvider;
diff --git a/tests/Unit/Database/Migration/MigrateTest.php b/tests/Unit/Database/Migration/MigrateTest.php
index c71a1b7d..6dd4ecb9 100644
--- a/tests/Unit/Database/Migration/MigrateTest.php
+++ b/tests/Unit/Database/Migration/MigrateTest.php
@@ -24,7 +24,7 @@ class MigrateTest extends TestCase
{
/** @var Application|MockObject $app */
$app = $this->getMockBuilder(Application::class)
- ->setMethods(['instance'])
+ ->onlyMethods(['instance'])
->getMock();
/** @var SchemaBuilder|MockObject $builder */
$builder = $this->getMockBuilder(SchemaBuilder::class)
@@ -33,7 +33,7 @@ class MigrateTest extends TestCase
/** @var Migrate|MockObject $migration */
$migration = $this->getMockBuilder(Migrate::class)
->setConstructorArgs([$builder, $app])
- ->setMethods(['initMigration', 'getMigrationFiles', 'getMigrated', 'migrate', 'setMigrated'])
+ ->onlyMethods(['initMigration', 'getMigrationFiles', 'getMigrated', 'migrate', 'setMigrated'])
->getMock();
$migration->expects($this->atLeastOnce())
diff --git a/tests/Unit/Exceptions/HandlerTest.php b/tests/Unit/Exceptions/HandlerTest.php
index baf2de82..494afd31 100644
--- a/tests/Unit/Exceptions/HandlerTest.php
+++ b/tests/Unit/Exceptions/HandlerTest.php
@@ -33,7 +33,7 @@ class HandlerTest extends TestCase
{
/** @var Handler|MockObject $handler */
$handler = $this->getMockBuilder(Handler::class)
- ->setMethods(['exceptionHandler'])
+ ->onlyMethods(['exceptionHandler'])
->getMock();
$handler->expects($this->once())
@@ -65,7 +65,7 @@ class HandlerTest extends TestCase
/** @var Handler|MockObject $handler */
$handler = $this->getMockBuilder(Handler::class)
- ->setMethods(['terminateApplicationImmediately'])
+ ->onlyMethods(['terminateApplicationImmediately'])
->getMock();
$handler->expects($this->once())
->method('terminateApplicationImmediately');
diff --git a/tests/Unit/Helpers/AuthenticatorTest.php b/tests/Unit/Helpers/AuthenticatorTest.php
index 83dc72ad..1dc39a28 100644
--- a/tests/Unit/Helpers/AuthenticatorTest.php
+++ b/tests/Unit/Helpers/AuthenticatorTest.php
@@ -128,7 +128,7 @@ class AuthenticatorTest extends ServiceProviderTest
/** @var Authenticator|MockObject $auth */
$auth = $this->getMockBuilder(Authenticator::class)
->setConstructorArgs([$request, $session, $userRepository])
- ->setMethods(['getPermissionsByGroup', 'getPermissionsByUser', 'user'])
+ ->onlyMethods(['getPermissionsByGroup', 'getPermissionsByUser', 'user'])
->getMock();
$auth->expects($this->exactly(1))
->method('getPermissionsByGroup')
@@ -203,7 +203,7 @@ class AuthenticatorTest extends ServiceProviderTest
/** @var Authenticator|MockObject $auth */
$auth = $this->getMockBuilder(Authenticator::class)
->disableOriginalConstructor()
- ->setMethods(['setPassword'])
+ ->onlyMethods(['setPassword'])
->getMock();
$auth->expects($this->once())
diff --git a/tests/Unit/Helpers/Translation/TranslatorTest.php b/tests/Unit/Helpers/Translation/TranslatorTest.php
index c173209a..afb1aabc 100644
--- a/tests/Unit/Helpers/Translation/TranslatorTest.php
+++ b/tests/Unit/Helpers/Translation/TranslatorTest.php
@@ -26,7 +26,7 @@ class TranslatorTest extends ServiceProviderTest
/** @var callable|MockObject $localeChange */
$localeChange = $this->getMockBuilder(stdClass::class)
- ->setMethods(['__invoke'])
+ ->addMethods(['__invoke'])
->getMock();
$localeChange->expects($this->exactly(2))
->method('__invoke')
@@ -56,7 +56,7 @@ class TranslatorTest extends ServiceProviderTest
/** @var Translator|MockObject $translator */
$translator = $this->getMockBuilder(Translator::class)
->setConstructorArgs(['de_DE', 'en_US', function () { }, ['de_DE' => 'Deutsch']])
- ->setMethods(['translateText'])
+ ->onlyMethods(['translateText'])
->getMock();
$translator->expects($this->exactly(2))
->method('translateText')
@@ -78,7 +78,7 @@ class TranslatorTest extends ServiceProviderTest
/** @var Translator|MockObject $translator */
$translator = $this->getMockBuilder(Translator::class)
->setConstructorArgs(['de_DE', 'en_US', function () { }, ['de_DE' => 'Deutsch']])
- ->setMethods(['translateText'])
+ ->onlyMethods(['translateText'])
->getMock();
$translator->expects($this->once())
->method('translateText')
@@ -100,7 +100,7 @@ class TranslatorTest extends ServiceProviderTest
$gtt = $this->createMock(GettextTranslator::class);
/** @var callable|MockObject $getTranslator */
$getTranslator = $this->getMockBuilder(stdClass::class)
- ->setMethods(['__invoke'])
+ ->addMethods(['__invoke'])
->getMock();
$getTranslator->expects($this->exactly(5))
->method('__invoke')
diff --git a/tests/Unit/Http/RequestServiceProviderTest.php b/tests/Unit/Http/RequestServiceProviderTest.php
index 0a2ae31d..07dab086 100644
--- a/tests/Unit/Http/RequestServiceProviderTest.php
+++ b/tests/Unit/Http/RequestServiceProviderTest.php
@@ -59,7 +59,7 @@ class RequestServiceProviderTest extends ServiceProviderTest
/** @var ServiceProvider|MockObject $serviceProvider */
$serviceProvider = $this->getMockBuilder(RequestServiceProvider::class)
->setConstructorArgs([$app])
- ->setMethods(['setTrustedProxies'])
+ ->onlyMethods(['setTrustedProxies'])
->getMock();
$serviceProvider->expects($this->once())
->method('setTrustedProxies')
diff --git a/tests/Unit/Http/RequestTest.php b/tests/Unit/Http/RequestTest.php
index 3f52709d..1635f73d 100644
--- a/tests/Unit/Http/RequestTest.php
+++ b/tests/Unit/Http/RequestTest.php
@@ -93,7 +93,7 @@ class RequestTest extends TestCase
/** @var Request|MockObject $request */
$request = $this
->getMockBuilder(Request::class)
- ->setMethods(['getPathInfo'])
+ ->onlyMethods(['getPathInfo'])
->getMock();
$request
@@ -116,7 +116,7 @@ class RequestTest extends TestCase
/** @var Request|MockObject $request */
$request = $this
->getMockBuilder(Request::class)
- ->setMethods(['getUri'])
+ ->onlyMethods(['getUri'])
->getMock();
$request
@@ -139,7 +139,7 @@ class RequestTest extends TestCase
/** @var Request|MockObject $request */
$request = $this
->getMockBuilder(Request::class)
- ->setMethods(['getQueryString', 'path'])
+ ->onlyMethods(['getQueryString', 'path'])
->getMock();
$request->expects($this->exactly(2))
diff --git a/tests/Unit/Http/SessionServiceProviderTest.php b/tests/Unit/Http/SessionServiceProviderTest.php
index 08f1945a..84dfd9d1 100644
--- a/tests/Unit/Http/SessionServiceProviderTest.php
+++ b/tests/Unit/Http/SessionServiceProviderTest.php
@@ -36,7 +36,7 @@ class SessionServiceProviderTest extends ServiceProviderTest
/** @var SessionServiceProvider|MockObject $serviceProvider */
$serviceProvider = $this->getMockBuilder(SessionServiceProvider::class)
->setConstructorArgs([$app])
- ->setMethods(['isCli'])
+ ->onlyMethods(['isCli'])
->getMock();
/** @var Config|MockObject $config */
@@ -175,7 +175,7 @@ class SessionServiceProviderTest extends ServiceProviderTest
$sessionStorage = $this->getMockForAbstractClass(StorageInterface::class);
return $this->getMockBuilder(Session::class)
->setConstructorArgs([$sessionStorage])
- ->setMethods(['start', 'has', 'set'])
+ ->onlyMethods(['start', 'has', 'set'])
->getMock();
}
@@ -185,7 +185,7 @@ class SessionServiceProviderTest extends ServiceProviderTest
private function getRequestMock()
{
return $this->getMockBuilder(Request::class)
- ->setMethods(['setSession'])
+ ->onlyMethods(['setSession'])
->getMock();
}
}
diff --git a/tests/Unit/Mail/Transport/LogTransportTest.php b/tests/Unit/Mail/Transport/LogTransportTest.php
index bd51d30f..6e67f648 100644
--- a/tests/Unit/Mail/Transport/LogTransportTest.php
+++ b/tests/Unit/Mail/Transport/LogTransportTest.php
@@ -44,7 +44,7 @@ class LogTransportTest extends TestCase
/** @var LogTransport|MockObject $transport */
$transport = $this->getMockBuilder(LogTransport::class)
->setConstructorArgs(['logger' => $logger])
- ->setMethods(['allRecipients'])
+ ->onlyMethods(['allRecipients'])
->getMock();
$transport->expects($this->exactly(2))
->method('allRecipients')
diff --git a/tests/Unit/Mail/Transport/TransportTest.php b/tests/Unit/Mail/Transport/TransportTest.php
index ac7735bb..8dd78d78 100644
--- a/tests/Unit/Mail/Transport/TransportTest.php
+++ b/tests/Unit/Mail/Transport/TransportTest.php
@@ -79,7 +79,7 @@ class TransportTest extends TestCase
$message = $this->createMock(SimpleMessage::class);
/** @var TransportImplementation|MockObject $transport */
$transport = $this->getMockBuilder(TransportImplementation::class)
- ->setMethods(['allRecipients'])
+ ->onlyMethods(['allRecipients'])
->getMock();
$transport->expects($this->once())
->method('allRecipients')
diff --git a/tests/Unit/Middleware/CallableHandlerTest.php b/tests/Unit/Middleware/CallableHandlerTest.php
index d59be60d..7721aadf 100644
--- a/tests/Unit/Middleware/CallableHandlerTest.php
+++ b/tests/Unit/Middleware/CallableHandlerTest.php
@@ -132,7 +132,7 @@ class CallableHandlerTest extends TestCase
$response = $this->createMock(Response::class);
/** @var callable|MockObject $callable */
$callable = $this->getMockBuilder(stdClass::class)
- ->setMethods(['__invoke'])
+ ->addMethods(['__invoke'])
->getMock();
return [$request, $response, $callable, $handler];
}
diff --git a/tests/Unit/Middleware/DispatcherTest.php b/tests/Unit/Middleware/DispatcherTest.php
index 6a6d9113..347d2071 100644
--- a/tests/Unit/Middleware/DispatcherTest.php
+++ b/tests/Unit/Middleware/DispatcherTest.php
@@ -49,7 +49,7 @@ class DispatcherTest extends TestCase
/** @var Dispatcher|MockObject $dispatcher */
$dispatcher = $this->getMockBuilder(Dispatcher::class)
- ->setMethods(['handle'])
+ ->onlyMethods(['handle'])
->getMock();
$dispatcher->expects($this->once())
@@ -158,7 +158,7 @@ class DispatcherTest extends TestCase
/** @var Dispatcher|MockObject $dispatcher */
$dispatcher = $this->getMockBuilder(Dispatcher::class)
->setConstructorArgs([[MiddlewareInterface::class, MiddlewareInterface::class]])
- ->setMethods(['resolveMiddleware'])
+ ->onlyMethods(['resolveMiddleware'])
->getMock();
$dispatcher->expects($this->exactly(2))
diff --git a/tests/Unit/Middleware/ErrorHandlerTest.php b/tests/Unit/Middleware/ErrorHandlerTest.php
index a9fdd71a..6ae604e0 100644
--- a/tests/Unit/Middleware/ErrorHandlerTest.php
+++ b/tests/Unit/Middleware/ErrorHandlerTest.php
@@ -141,7 +141,7 @@ class ErrorHandlerTest extends TestCase
/** @var ErrorHandler|MockObject $errorHandler */
$errorHandler = $this->getMockBuilder(ErrorHandler::class)
->disableOriginalConstructor()
- ->setMethods(['createResponse'])
+ ->onlyMethods(['createResponse'])
->getMock();
$errorHandler->expects($this->once())
diff --git a/tests/Unit/Middleware/LegacyMiddlewareTest.php b/tests/Unit/Middleware/LegacyMiddlewareTest.php
index cce7371a..a35768f3 100644
--- a/tests/Unit/Middleware/LegacyMiddlewareTest.php
+++ b/tests/Unit/Middleware/LegacyMiddlewareTest.php
@@ -29,7 +29,7 @@ class LegacyMiddlewareTest extends TestCase
/** @var LegacyMiddleware|MockObject $middleware */
$middleware = $this->getMockBuilder(LegacyMiddleware::class)
->setConstructorArgs([$container, $auth])
- ->setMethods(['loadPage', 'renderPage'])
+ ->onlyMethods(['loadPage', 'renderPage'])
->getMock();
/** @var Request|MockObject $defaultRequest */
$defaultRequest = $this->createMock(Request::class);
diff --git a/tests/Unit/Middleware/RequestHandlerTest.php b/tests/Unit/Middleware/RequestHandlerTest.php
index 8b943d71..21bb28c1 100644
--- a/tests/Unit/Middleware/RequestHandlerTest.php
+++ b/tests/Unit/Middleware/RequestHandlerTest.php
@@ -58,7 +58,7 @@ class RequestHandlerTest extends TestCase
/** @var RequestHandler|MockObject $middleware */
$middleware = $this->getMockBuilder(RequestHandler::class)
->setConstructorArgs([$container])
- ->setMethods(['resolveRequestHandler'])
+ ->onlyMethods(['resolveRequestHandler'])
->getMock();
$middleware->expects($this->exactly(3))
->method('resolveRequestHandler')
@@ -110,7 +110,7 @@ class RequestHandlerTest extends TestCase
/** @var RequestHandler|MockObject $middleware */
$middleware = $this->getMockBuilder(RequestHandler::class)
->setConstructorArgs([$container])
- ->setMethods(['resolveMiddleware'])
+ ->onlyMethods(['resolveMiddleware'])
->getMock();
$middleware->expects($this->once())
->method('resolveMiddleware')
@@ -174,7 +174,7 @@ class RequestHandlerTest extends TestCase
/** @var RequestHandler|MockObject $middleware */
$middleware = $this->getMockBuilder(RequestHandler::class)
->setConstructorArgs([$container])
- ->setMethods(['resolveRequestHandler'])
+ ->onlyMethods(['resolveRequestHandler'])
->getMock();
$middleware->expects($this->exactly(2))
diff --git a/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php b/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php
index 3947ac37..cf583a8d 100644
--- a/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php
+++ b/tests/Unit/Middleware/RouteDispatcherServiceProviderTest.php
@@ -62,7 +62,7 @@ class RouteDispatcherServiceProviderTest extends ServiceProviderTest
/** @var RouteDispatcherServiceProvider|MockObject $serviceProvider */
$serviceProvider = $this->getMockBuilder(RouteDispatcherServiceProvider::class)
->setConstructorArgs([$app])
- ->setMethods(['generateRouting'])
+ ->onlyMethods(['generateRouting'])
->getMock();
$serviceProvider->expects($this->once())
diff --git a/tests/Unit/Middleware/SendResponseHandlerTest.php b/tests/Unit/Middleware/SendResponseHandlerTest.php
index 427cd313..9189bd6d 100644
--- a/tests/Unit/Middleware/SendResponseHandlerTest.php
+++ b/tests/Unit/Middleware/SendResponseHandlerTest.php
@@ -18,7 +18,7 @@ class SendResponseHandlerTest extends TestCase
{
/** @var SendResponseHandler|MockObject $middleware */
$middleware = $this->getMockBuilder(SendResponseHandler::class)
- ->setMethods(['headersSent', 'sendHeader'])
+ ->onlyMethods(['headersSent', 'sendHeader'])
->getMock();
/** @var ServerRequestInterface|MockObject $request */
$request = $this->getMockForAbstractClass(ServerRequestInterface::class);
diff --git a/tests/Unit/Middleware/SessionHandlerTest.php b/tests/Unit/Middleware/SessionHandlerTest.php
index 3611b5c0..7d3dd13f 100644
--- a/tests/Unit/Middleware/SessionHandlerTest.php
+++ b/tests/Unit/Middleware/SessionHandlerTest.php
@@ -48,7 +48,7 @@ class SessionHandlerTest extends TestCase
/** @var SessionHandler|MockObject $middleware */
$middleware = $this->getMockBuilder(SessionHandler::class)
->setConstructorArgs([$sessionStorage, ['/foo']])
- ->setMethods(['destroyNative'])
+ ->onlyMethods(['destroyNative'])
->getMock();
$middleware->expects($this->once())
diff --git a/tests/Unit/Middleware/VerifyCsrfTokenTest.php b/tests/Unit/Middleware/VerifyCsrfTokenTest.php
index cd593106..ce045720 100644
--- a/tests/Unit/Middleware/VerifyCsrfTokenTest.php
+++ b/tests/Unit/Middleware/VerifyCsrfTokenTest.php
@@ -34,7 +34,7 @@ class VerifyCsrfTokenTest extends TestCase
/** @var VerifyCsrfToken|MockObject $middleware */
$middleware = $this->getMockBuilder(VerifyCsrfToken::class)
->disableOriginalConstructor()
- ->setMethods(['tokensMatch'])
+ ->onlyMethods(['tokensMatch'])
->getMock();
$middleware->expects($this->exactly(2))
@@ -74,7 +74,7 @@ class VerifyCsrfTokenTest extends TestCase
/** @var VerifyCsrfToken|MockObject $middleware */
$middleware = $this->getMockBuilder(VerifyCsrfToken::class)
->setConstructorArgs([$session])
- ->setMethods(['isReading'])
+ ->onlyMethods(['isReading'])
->getMock();
$middleware->expects($this->atLeastOnce())
diff --git a/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php b/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php
index 644e6d50..f81f210a 100644
--- a/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php
+++ b/tests/Unit/Renderer/Twig/Extensions/CsrfTest.php
@@ -31,7 +31,7 @@ class CsrfTest extends ExtensionTest
/** @var Csrf|MockObject $extension */
$extension = $this->getMockBuilder(Csrf::class)
->disableOriginalConstructor()
- ->setMethods(['getCsrfToken'])
+ ->onlyMethods(['getCsrfToken'])
->getMock();
$extension->expects($this->once())
diff --git a/tests/Unit/Renderer/TwigServiceProviderTest.php b/tests/Unit/Renderer/TwigServiceProviderTest.php
index ee4cd971..3f027684 100644
--- a/tests/Unit/Renderer/TwigServiceProviderTest.php
+++ b/tests/Unit/Renderer/TwigServiceProviderTest.php
@@ -48,7 +48,7 @@ class TwigServiceProviderTest extends ServiceProviderTest
/** @var TwigServiceProvider|MockObject $serviceProvider */
$serviceProvider = $this->getMockBuilder(TwigServiceProvider::class)
->setConstructorArgs([$app])
- ->setMethods(['registerTwigEngine'])
+ ->onlyMethods(['registerTwigEngine'])
->getMock();
$serviceProvider->expects($this->once())
->method('registerTwigEngine');
@@ -103,7 +103,7 @@ class TwigServiceProviderTest extends ServiceProviderTest
$config = $this->createMock(Config::class);
/** @var TwigCore|MockObject $twigCore */
$twigCore = $this->getMockBuilder(stdClass::class)
- ->setMethods(['setTimezone'])
+ ->addMethods(['setTimezone'])
->getMock();
$app = $this->getApp(['make', 'instance', 'tag', 'get']);
diff --git a/tests/Unit/ServiceProviderTest.php b/tests/Unit/ServiceProviderTest.php
index bf9f5e3f..3a1c2f77 100644
--- a/tests/Unit/ServiceProviderTest.php
+++ b/tests/Unit/ServiceProviderTest.php
@@ -14,7 +14,7 @@ abstract class ServiceProviderTest extends TestCase
protected function getApp($methods = ['make', 'instance'])
{
return $this->getMockBuilder(Application::class)
- ->setMethods($methods)
+ ->onlyMethods($methods)
->getMock();
}
}