Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Commit

Permalink
use phpunit 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
brainexe committed Jun 4, 2016
1 parent 98d432e commit 5e1cd2f
Show file tree
Hide file tree
Showing 68 changed files with 265 additions and 224 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -17,7 +17,7 @@ before_install:
- wget https://scrutinizer-ci.com/ocular.phar -q

script:
- phpunit --coverage-clover=coverage.clover
- php vendor/bin/phpunit --coverage-clover=coverage.clover

after_script:
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
12 changes: 6 additions & 6 deletions Tests/BrainExe/Core/Application/AppKernelTest.php
Expand Up @@ -48,10 +48,10 @@ class AppKernelTest extends TestCase

public function setUp()
{
$this->controllerResolver = $this->getMock(ControllerResolver::class, [], [], '', false);
$this->routeCollection = $this->getMock(SerializedRouteCollection::class, [], [], '', false);
$this->middleWare = $this->getMock(MiddlewareInterface::class, [], [], '', false);
$this->urlMatcher = $this->getMock(UrlMatcher::class);
$this->controllerResolver = $this->createMock(ControllerResolver::class);
$this->routeCollection = $this->createMock(SerializedRouteCollection::class);
$this->middleWare = $this->createMock(MiddlewareInterface::class);
$this->urlMatcher = $this->createMock(UrlMatcher::class);

$this->subject = new AppKernel(
$this->controllerResolver,
Expand All @@ -71,7 +71,7 @@ public function testHandle()
'_route' => $routeName = 'route_name'
];

$route = $this->getMock(Route::class, [], [], '', false);
$route = $this->createMock(Route::class);

$this->middleWare
->expects($this->once())
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testHandleRequestMiddleware()
'_route' => $routeName = 'route_name'
];

$route = $this->getMock(Route::class, [], [], '', false);
$route = $this->createMock(Route::class);

$this->middleWare
->expects($this->once())
Expand Down
2 changes: 1 addition & 1 deletion Tests/BrainExe/Core/Application/ControllerResolverTest.php
Expand Up @@ -26,7 +26,7 @@ class ControllerResolverTest extends TestCase

public function setUp()
{
$this->container = $this->getMock(Container::class, [], [], '', false);
$this->container = $this->createMock(Container::class);

$this->subject = new ControllerResolver($this->container);
}
Expand Down
Expand Up @@ -27,7 +27,7 @@ class CreateTokenTest extends TestCase

public function setUp()
{
$this->token = $this->getMock(Token::class, [], [], '', false);
$this->token = $this->createMock(Token::class);

$this->subject = new CreateToken($this->token);
}
Expand Down
Expand Up @@ -27,7 +27,7 @@ class ListTokensTest extends TestCase

public function setUp()
{
$this->token = $this->getMock(Token::class, [], [], '', false);
$this->token = $this->createMock(Token::class);

$this->subject = new ListTokens($this->token);
}
Expand Down
Expand Up @@ -31,7 +31,7 @@ class LoginControllerTest extends TestCase

public function setUp()
{
$this->login = $this->getMock(Login::class, [], [], '', false);
$this->login = $this->createMock(Login::class);
$this->subject = new LoginController($this->login);
}

Expand Down
Expand Up @@ -33,8 +33,8 @@ class PasswordControllerTest extends TestCase

public function setUp()
{
$this->userProvider = $this->getMock(UserProvider::class, [], [], '', false);
$this->passwordHasher = $this->getMock(PasswordHasher::class, [], [], '', false);
$this->userProvider = $this->createMock(UserProvider::class);
$this->passwordHasher = $this->createMock(PasswordHasher::class);

$this->subject = new PasswordController(
$this->userProvider,
Expand Down
Expand Up @@ -29,7 +29,7 @@ class RegisterControllerTest extends TestCase

public function setUp()
{
$this->register = $this->getMock(Register::class, [], [], '', false);
$this->register = $this->createMock(Register::class);

$this->subject = new RegisterController($this->register);
}
Expand Down
Expand Up @@ -26,7 +26,7 @@ class SettingsControllerTest extends TestCase

public function setUp()
{
$this->settings = $this->getMock(Settings::class, [], [], '', false);
$this->settings = $this->createMock(Settings::class);

$this->subject = new SettingsController($this->settings);
}
Expand Down
Expand Up @@ -27,7 +27,7 @@ class TokenControllerTest extends TestCase

public function setUp()
{
$this->token = $this->getMock(Token::class);
$this->token = $this->createMock(Token::class);
$this->subject = new TokenController($this->token);
}

Expand Down
Expand Up @@ -27,7 +27,7 @@ class UserControllerTest extends TestCase

public function setUp()
{
$this->userProvider = $this->getMock(UserProvider::class, [], [], '', false);
$this->userProvider = $this->createMock(UserProvider::class);
$this->subject = new UserController($this->userProvider);
}

Expand Down
Expand Up @@ -15,7 +15,7 @@ class AuthenticateUserEventTest extends TestCase
public function testEvent()
{
/** @var AuthenticationDataVO $auth */
$auth = $this->getMock(AuthenticationDataVO::class, [], [], '', false);
$auth = $this->createMock(AuthenticationDataVO::class);
$eventName = 'eventName';

$subject = new AuthenticateUserEvent($auth, $eventName);
Expand Down
8 changes: 4 additions & 4 deletions Tests/BrainExe/Core/Authentication/LoginTest.php
Expand Up @@ -49,10 +49,10 @@ class LoginTest extends TestCase

public function setUp()
{
$this->loadUser = $this->getMock(LoadUser::class, [], [], '', false);
$this->dispatcher = $this->getMock(EventDispatcher::class, [], [], '', false);
$this->token = $this->getMock(Token::class, [], [], '', false);
$this->passwordHasher = $this->getMock(PasswordHasher::class, [], [], '', false);
$this->loadUser = $this->createMock(LoadUser::class);
$this->dispatcher = $this->createMock(EventDispatcher::class);
$this->token = $this->createMock(Token::class);
$this->passwordHasher = $this->createMock(PasswordHasher::class);

$this->subject = new Login($this->loadUser, $this->token, $this->passwordHasher);
$this->subject->setEventDispatcher($this->dispatcher);
Expand Down
4 changes: 2 additions & 2 deletions Tests/BrainExe/Core/Authentication/RegisterTest.php
Expand Up @@ -35,8 +35,8 @@ class RegisterTest extends TestCase

public function setUp()
{
$this->userProvider = $this->getMock(UserProvider::class, [], [], '', false);
$this->registerTokens = $this->getMock(RegisterTokens::class, [], [], '', false);
$this->userProvider = $this->createMock(UserProvider::class);
$this->registerTokens = $this->createMock(RegisterTokens::class);

$this->subject = new Register($this->userProvider, $this->registerTokens, false);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/BrainExe/Core/Authentication/RegisterTokensTest.php
Expand Up @@ -35,7 +35,7 @@ class RegisterTokensTest extends TestCase
public function setUp()
{
$this->redis = $this->getRedisMock();
$this->idGenerator = $this->getMock(IdGenerator::class, [], [], '', false);
$this->idGenerator = $this->createMock(IdGenerator::class);

$this->subject = new RegisterTokens();
$this->subject->setRedis($this->redis);
Expand Down
Expand Up @@ -25,7 +25,7 @@ class SettingsTest extends TestCase

public function setUp()
{
$this->gateway = $this->getMock(Gateway::class, [], [], '', false);
$this->gateway = $this->createMock(Gateway::class);
$this->subject = new Settings($this->gateway);
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/BrainExe/Core/Authentication/TokenTest.php
Expand Up @@ -35,7 +35,7 @@ class TokenTest extends TestCase
public function setUp()
{
$this->predis = $this->getRedisMock();
$this->idGenerator = $this->getMock(IdGenerator::class);
$this->idGenerator = $this->createMock(IdGenerator::class);
$this->subject = new Token();
$this->subject->setRedis($this->predis);
$this->subject->setIdGenerator($this->idGenerator);
Expand Down
8 changes: 4 additions & 4 deletions Tests/BrainExe/Core/Authentication/UserProviderTest.php
Expand Up @@ -55,10 +55,10 @@ class UserProviderTest extends TestCase
public function setUp()
{
$this->redis = $this->getRedisMock();
$this->idGenerator = $this->getMock(IdGenerator::class, [], [], '', false);
$this->loadUser = $this->getMock(LoadUser::class, [], [], '', false);
$this->hasher = $this->getMock(PasswordHasher::class, [], [], '', false);
$this->dispatcher = $this->getMock(EventDispatcher::class, [], [], '', false);
$this->idGenerator = $this->createMock(IdGenerator::class);
$this->loadUser = $this->createMock(LoadUser::class);
$this->hasher = $this->createMock(PasswordHasher::class);
$this->dispatcher = $this->createMock(EventDispatcher::class);

$this->subject = new UserProvider($this->hasher, $this->loadUser);
$this->subject->setRedis($this->redis);
Expand Down
4 changes: 2 additions & 2 deletions Tests/BrainExe/Core/Console/ClearCacheCommandTest.php
Expand Up @@ -33,8 +33,8 @@ class ClearCacheCommandTest extends TestCase

public function setUp()
{
$this->rebuild = $this->getMock(Rebuild::class, [], [], '', false);
$this->dispatcher = $this->getMock(EventDispatcher::class, [], [], '', false);
$this->rebuild = $this->createMock(Rebuild::class);
$this->dispatcher = $this->createMock(EventDispatcher::class);

$this->subject = new ClearCacheCommand($this->rebuild);
$this->subject->setEventDispatcher($this->dispatcher);
Expand Down
Expand Up @@ -27,7 +27,7 @@ class CreateRegisterLinkCommandTest extends PHPUnit_Framework_TestCase

public function setUp()
{
$this->registerTokens = $this->getMock(RegisterTokens::class, [], [], '', false);
$this->registerTokens = $this->createMock(RegisterTokens::class);

$this->subject = new CreateRegisterLinkCommand($this->registerTokens);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/BrainExe/Core/Console/CreateUserCommandTest.php
Expand Up @@ -30,7 +30,7 @@ class CreateUserCommandTest extends PHPUnit_Framework_TestCase

public function setUp()
{
$this->mockRegister = $this->getMock(Register::class, [], [], '', false);
$this->mockRegister = $this->createMock(Register::class);

$this->subject = new CreateUserCommand($this->mockRegister);
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/BrainExe/Core/Console/ListServicesCommandTest.php
Expand Up @@ -35,8 +35,8 @@ class ListServicesCommandTest extends TestCase

public function setUp()
{
$this->rebuild = $this->getMock(Rebuild::class, [], [], '', false);
$this->dispatcher = $this->getMock(EventDispatcher::class, [], [], '', false);
$this->rebuild = $this->createMock(Rebuild::class);
$this->dispatcher = $this->createMock(EventDispatcher::class);

$this->subject = new ListServicesCommand($this->rebuild);
$this->subject->setEventDispatcher($this->dispatcher);
Expand Down Expand Up @@ -100,8 +100,8 @@ private function setupMocks()
'getDefinition',
'hasDefinition'
]);
$definition1 = $this->getMock(Definition::class);
$definition2 = $this->getMock(Definition::class);
$definition1 = $this->createMock(Definition::class);
$definition2 = $this->createMock(Definition::class);

$this->rebuild
->expects($this->once())
Expand Down
2 changes: 1 addition & 1 deletion Tests/BrainExe/Core/Console/ListenerTest.php
Expand Up @@ -25,7 +25,7 @@ class ListenerTest extends TestCase

public function setUp()
{
$this->application = $this->getMock(Application::class, [], [], '', false);
$this->application = $this->createMock(Application::class);

$this->subject = new Listener($this->application);
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/BrainExe/Core/Console/ServerRunCommandTest.php
Expand Up @@ -28,7 +28,7 @@ class ServerRunCommandTest extends PHPUnit_Framework_TestCase

public function setUp()
{
$this->mockProcessBuilder = $this->getMock(ProcessBuilder::class, [], [], '', false);
$this->mockProcessBuilder = $this->createMock(ProcessBuilder::class);

$this->subject = new ServerRunCommand($this->mockProcessBuilder, 'localhost:8080');
}
Expand All @@ -41,7 +41,7 @@ public function testExecute()

$commandTester = new CommandTester($this->subject);

$process = $this->getMock(Process::class, [], [], '', false);
$process = $this->createMock(Process::class);

$this->mockProcessBuilder
->expects($this->once())
Expand Down
Expand Up @@ -33,12 +33,8 @@ class ConsoleCompilerPassTest extends TestCase
public function setUp()
{
$this->subject = new ConsoleCompilerPass();
$this->container = $this->getMock(ContainerBuilder::class, [
'findTaggedServiceIds',
'getDefinition',
'get'
]);
$this->consoleDefinition = $this->getMock(Definition::class);
$this->container = $this->createMock(ContainerBuilder::class);
$this->consoleDefinition = $this->createMock(Definition::class);
}

public function testAddSubscriber()
Expand All @@ -47,7 +43,7 @@ public function testAddSubscriber()

$definition = new InputDefinition();

$command = $this->getMock(Command::class, [], [], '', false);
$command = $this->createMock(Command::class);
$command
->expects($this->once())
->method('getDefinition')
Expand Down
Expand Up @@ -29,12 +29,9 @@ class ControllerCompilerPassTest extends TestCase

public function setUp()
{
$this->subject = $this->getMock(ControllerCompilerPass::class, ['dumpMatcher']);
$this->container = $this->getMock(ContainerBuilder::class, [
'findTaggedServiceIds',
'getDefinition',
]);
$this->routerDefinition = $this->getMock(Definition::class);
$this->subject = $this->createMock(ControllerCompilerPass::class);
$this->container = $this->createMock(ContainerBuilder::class);
$this->routerDefinition = $this->createMock(Definition::class);
}

public function testProcess()
Expand All @@ -44,7 +41,7 @@ public function testProcess()

$route1->setCsrf(true);

$service = $this->getMock(Definition::class);
$service = $this->createMock(Definition::class);
$serviceIds = [
$serviceId = 'service_id' => [
[$route1],
Expand Down
Expand Up @@ -49,11 +49,8 @@ public function setUp()
{
$this->subject = new EventListenerCompilerPass();

$this->container = $this->getMock(ContainerBuilder::class, [
'getDefinition',
'findTaggedServiceIds'
]);
$this->dispatcher = $this->getMock(Definition::class);
$this->container = $this->createMock(ContainerBuilder::class);
$this->dispatcher = $this->createMock(Definition::class);
}

/**
Expand All @@ -76,7 +73,7 @@ public function testAddSubscriber()
->with(EventListenerCompilerPass::TAG)
->willReturn([$serviceId => []]);

$definition = $this->getMock(Definition::class);
$definition = $this->createMock(Definition::class);
$definition
->expects($this->any())
->method('getClass')
Expand Down
Expand Up @@ -25,21 +25,14 @@ class GlobalCompilerPassTest extends TestCase
public function setUp()
{
$this->subject = new GlobalCompilerPass();
$this->container = $this->getMock(ContainerBuilder::class, [
'getDefinition',
'getParameter',
'setParameter',
'get',
'findTaggedServiceIds',
'reset'
]);
$this->container = $this->createMock(ContainerBuilder::class);
}

public function testProcessCompiler()
{
$serviceId = 'FooCompilerPass';
$compiler = $this->getMock(CompilerPassInterface::class);
$logger = $this->getMock(Logger::class, [], [], '', false);
$compiler = $this->createMock(CompilerPassInterface::class);
$logger = $this->createMock(Logger::class);

$this->container
->expects($this->at(0))
Expand Down
Expand Up @@ -25,15 +25,12 @@ public function setUp()
{
$this->subject = new LocaleCompilerPass();

$this->container = $this->getMock(ContainerBuilder::class, [
'get',
'setParameter',
]);
$this->container = $this->createMock(ContainerBuilder::class);
}

public function testProcess()
{
$glob = $this->getMock(Glob::class);
$glob = $this->createMock(Glob::class);

$glob
->expects($this->once())
Expand Down

0 comments on commit 5e1cd2f

Please sign in to comment.