Tests: Replaced setMethods as it is deprecated
This commit is contained in:
parent
109f112131
commit
867d720f15
|
@ -117,8 +117,8 @@ class EngelsystemLoggerTest extends ApplicationFeatureTest
|
|||
LogEntry::query()->truncate();
|
||||
$logger = $this->getLogger();
|
||||
|
||||
$mock = $this->getMockBuilder('someDataProvider')
|
||||
->setMethods(['__toString'])
|
||||
$mock = $this->getMockBuilder(stdClass::class)
|
||||
->addMethods(['__toString'])
|
||||
->getMock();
|
||||
|
||||
$mock->expects($this->atLeastOnce())
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue