public function test_launchkey_sso_session_redirects_to_logout_url_and_exits()
 {
     $this->user->launchkey_sso_session = "Not Null";
     $this->client->logout();
     Phake::inOrder(Phake::verify($this->facade)->wp_redirect(static::LOGOUT_URL), Phake::verify($this->facade)->_exit(Phake::anyParameters()));
     Phake::verifyNoFurtherInteraction($this->facade);
 }
コード例 #2
0
 public function testFindInTrans()
 {
     $this->target->begin();
     $this->target->find('hoge', 'ssd', array('a', 'b', 3), 'fuga');
     \Phake::verify($this->write)->find('hoge', 'ssd', array('a', 'b', 3), 'fuga');
     \Phake::verify($this->read, \Phake::never())->find('hoge', 'ssd', array('a', 'b', 3), 'fuga');
 }
コード例 #3
0
ファイル: WorkerTest.php プロジェクト: drsnyder/brook
 public function testRunAsWorker()
 {
     $receiver = \Phake::mock('ZMQSocket');
     $sender = \Phake::mock('ZMQSocket');
     $controller = \Phake::mock('ZMQSocket');
     $poller = \Phake::mock('ZMQPoll');
     $worker = \Phake::partialMock('\\Brook\\Worker');
     $task = \Phake::mock('\\Brook\\TaskInterface');
     // signal we are a child
     \Phake::when($worker)->fork()->thenReturn(0);
     \Phake::when($worker)->poll()->thenReturn(\Brook\Worker::READ_READY)->thenReturn(\Brook\Worker::SHUTDOWN);
     $message = "one message";
     \Phake::when($task)->setup()->thenReturn(null);
     \Phake::when($task)->tearDown()->thenReturn(null);
     \Phake::when($task)->work($message)->thenReturn($message);
     \Phake::when($receiver)->recv()->thenReturn($message);
     \Phake::when($sender)->send($message)->thenReturn(true);
     // verify
     $worker->setReceiver($receiver);
     $worker->setController($controller);
     $worker->setSender($sender);
     $worker->setPoller($poller);
     $this->assertEquals(1, $worker->run($task));
     \Phake::verify($worker)->fork();
     \Phake::verify($sender)->send($message);
     \Phake::verify($worker)->forward($message);
     \Phake::verify($task)->setup();
     \Phake::verify($task)->tearDown();
     \Phake::verify($task)->work($message);
 }
コード例 #4
0
 public function testCorrelationDataIsAttached()
 {
     CorrelationDataHolder::setCorrelationData(array('correlationId' => 'test'));
     $this->testSubject->send(new HelloCommand('Hi !!!'));
     \Phake::verify($this->mockCommandBus)->dispatch(\Phake::capture($command), null);
     $this->assertEquals(array('correlationId' => 'test'), $command->getMetaData()->all());
 }
 public function test_does_not_update_option_when_check_option_returns_errors()
 {
     $_POST['nonce'] = 'not empty';
     Phake::when($this->admin)->check_option(Phake::anyParameters())->thenReturn(array(array(), array('error')));
     $this->wizard->wizard_submit_ajax();
     Phake::verify($this->facade, Phake::never())->update_option(Phake::anyParameters());
 }
コード例 #6
0
 /**
  * @test
  */
 public function parseNormal()
 {
     \Phake::when($this->commentsParser)->parse(\Phake::anyParameters())->thenReturn(null);
     $stmts = (include __DIR__ . '/../fixtures/1/Model/Product.php.property_base.cache');
     $this->parser->parse($stmts, $this->property, $this->class);
     \Phake::verify($this->commentsParser)->parse(\Phake::anyParameters());
 }
コード例 #7
0
 /**
  * @test
  */
 public function parseNormal()
 {
     \Phake::when($this->parser)->parse(\Phake::anyParameters())->thenReturn(null);
     $path = __DIR__ . '/../fixtures/1';
     $this->projectParser->parse($path);
     \Phake::verify($this->parser, \Phake::times(3))->parse(\Phake::anyParameters());
 }
コード例 #8
0
 public function testBuild()
 {
     $containerBuilder = \Phake::mock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $bundle = new ModeraRoutingBundle();
     $bundle->build($containerBuilder);
     \Phake::verify($containerBuilder, \Phake::atLeast(2))->addCompilerPass($this->isInstanceOf('Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface'));
 }
 /**
  * @param $cookie_name
  *
  * @dataProvider cookie_name_provider
  */
 public function test_launchkey_logout_expires_cookies($cookie_name)
 {
     $_COOKIE['launchkey_access_token'] = 'access token';
     $this->client->launchkey_logout();
     Phake::verify($this->facade)->current_time('timestamp', true);
     Phake::verify($this->facade)->setcookie($cookie_name, '1', $this->current_time - 60, COOKIEPATH, COOKIE_DOMAIN);
 }
コード例 #10
0
ファイル: StartTest.php プロジェクト: t-ishida/Moshas
 public function testWork()
 {
     \Phake::when($this->scraper)->scrape(\Phake::anyParameters())->thenReturn(array(new Entity(), new Entity()));
     $result = $this->target->work(null);
     \Phake::verify($this->scraper)->scrape($this->definition);
     $this->assertCount(2, $result);
 }
コード例 #11
0
 public function testBuild()
 {
     $builder = \Phake::mock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $bundle = new ModeraMJRSecurityIntegrationBundle();
     $bundle->build($builder);
     \Phake::verify($builder, \Phake::times(1))->addCompilerPass($this->isInstanceOf('Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface'));
 }
コード例 #12
0
ファイル: FreezerTest.php プロジェクト: eric-seekas/Phake
 public function testFreeze()
 {
     $client = Phake::mock('Phake_Client_IClient');
     $this->freezer->freeze($this->mockInfo, $client);
     Phake::verify($client)->processObjectFreeze();
     Phake::verify($this->mockInfo)->freezeObject();
 }
コード例 #13
0
 public function testConfigureCustomAggregateFactory()
 {
     $this->fixture->registerAggregateFactory($this->mockAggregateFactory);
     $this->fixture->registerAnnotatedCommandHandler(new MyCommandHandler($this->fixture->getRepository(), $this->fixture->getEventBus()));
     $this->fixture->given([new MyEvent("id1", 1)])->when(new TestCommand("id1"));
     \Phake::verify($this->mockAggregateFactory, \Phake::atLeast(1))->createAggregate(\Phake::equalTo("id1"), \Phake::anyParameters());
 }
コード例 #14
0
 public function testToString()
 {
     Phake::when($this->adapted)->__toString->thenReturn('test string');
     $result = $this->matcher->__toString();
     Phake::verify($this->adapted)->__toString();
     $this->assertEquals('test string', $result);
 }
コード例 #15
0
 public function testMagicCallIsRecorded()
 {
     $mock = $this->getMock('Phake_IMock');
     $ref = array('foo', array());
     $this->handler->invoke($mock, '__call', array('foo', array()), $ref);
     Phake::verify($this->callRecorder)->recordCall(new Phake_CallRecorder_Call($mock, 'foo', array(), $this->mockReader));
 }
コード例 #16
0
 public function testReset()
 {
     $this->registry->resetAll();
     Phake::verify($this->info1)->resetInfo();
     Phake::verify($this->info2)->resetInfo();
     Phake::verify($this->info3)->resetInfo();
 }
コード例 #17
0
ファイル: WebTest.php プロジェクト: jessecascio/spider
 public function testStorageDestruct()
 {
     $this->Web->queries($this->queries);
     $this->Web->crawl();
     // assertion maximus
     \Phake::verify($this->Storage, \Phake::times(1))->destruct();
 }
コード例 #18
0
 public function testSkipsDictionariesWithoutCustomSuffixInFilenameCustom()
 {
     $this->createLoader('testlangcode');
     $dictionariesDir = $this->resourcesDir . '/no-dictionaries';
     $this->dictionaryLoader->addFromDir($dictionariesDir);
     Phake::verify($this->templateMock, Phake::times(0))->includeInlineTranslation(Phake::anyParameters());
 }
 /**
  * @dataProvider data_provider_option_check_return_for_private_key
  *
  * @param $files_value
  * @param $expected
  */
 public function test_check_option_return_for_file_input($files_value, $expected)
 {
     $_FILES = $files_value;
     list($actual, $errors) = $this->client->check_option($this->options);
     Phake::verify($this->facade)->get_option(LaunchKey_WP_Admin::OPTION_KEY);
     $this->assertSame($expected, $actual[LaunchKey_WP_Options::OPTION_PRIVATE_KEY]);
 }
コード例 #20
0
ファイル: ScopesDaoTest.php プロジェクト: aainc/Behoimi
 public function testFindNoResult()
 {
     $entity = (object) array("id" => 1, "authorized_application_id" => 1, "scope" => 1);
     \Phake::when($this->databaseSession)->find("SELECT * FROM scopes WHERE id = ?", "i", array(1))->thenReturn(array());
     $result = $this->target->find(array(1));
     \Phake::verify($this->databaseSession)->find("SELECT * FROM scopes WHERE id = ?", "i", array(1));
     $this->assertSame(null, $result);
 }
 public function test_exceptions_log_when_debug()
 {
     $this->user->launchkey_auth = 'auth_request_id';
     Phake::when($this->facade)->is_debug_log()->thenReturn(true);
     Phake::when($this->sdk_auth)->deOrbit(Phake::anyParameters())->thenThrow(new Exception('Expected Message'));
     $this->client->logout();
     Phake::verify($this->facade)->error_log($this->stringContains('Expected Message'));
 }
コード例 #22
0
 public function testStaticCallIsRecorded()
 {
     $mock = $this->getMock('Phake_IMock');
     $mockClass = get_class($mock);
     $ref = array();
     $this->handler->invoke($mockClass, 'foo', array(), $ref);
     Phake::verify($this->callRecorder)->recordCall(new Phake_CallRecorder_Call($mockClass, 'foo', array()));
 }
コード例 #23
0
 public function testPostLoadWithEntity()
 {
     $user = \Phake::mock(User::clazz());
     $event = $this->createEvent($user);
     $listener = new RootUserHandlerInjectionListener($this->container);
     $listener->postLoad($event);
     \Phake::verify($user)->init($this->rootUserHandler);
 }
コード例 #24
0
 public function testTranslateIsStoredInCache()
 {
     $applicationCacheMock = Phake::mock('Zend_Cache_Backend_Apc');
     $cacheProxy = new EngineBlock_Translate_CacheProxy($this->files, $applicationCacheMock);
     /** @var $translate Zend_Translate */
     $cacheProxy->load();
     Phake::verify($applicationCacheMock)->save(Phake::anyParameters());
 }
コード例 #25
0
 public function testPost()
 {
     $accountingEntryRepoMock = \Phake::mock('myfinance\\repositories\\AccountingEntryRepository');
     $controller = new AccountingEntryController($accountingEntryRepoMock);
     $json = '{"amount":"12.15",description":"Reperatur bei Autohaus","date":"2015-09-03","account":"1","category","2"}';
     $controller->post(json_decode($json));
     \Phake::verify($accountingEntryRepoMock)->create(\Phake::ignoreRemaining());
 }
コード例 #26
0
 public function testPost()
 {
     $accountRepoMock = \Phake::mock('myfinance\\repositories\\AccountRepository');
     $controller = new AccountController($accountRepoMock);
     $json = '{"description":"LUKB von User1","saldo":"0.00"}';
     $controller->post(json_decode($json));
     \Phake::verify($accountRepoMock)->create(\Phake::ignoreRemaining());
 }
コード例 #27
0
 public function testExecuteNoResultNoParameter()
 {
     \Phake::when($this->target)->getAffectedRows()->thenReturn(0);
     \Phake::when($this->connection)->prepare('DROP TABLE')->thenReturn($this->statement);
     $this->target->executeNoResult('DROP TABLE');
     \Phake::verify($this->statement, \Phake::never())->bind_param(\Phake::anyParameters());
     \Phake::verify($this->statement)->close();
 }
コード例 #28
0
 public function testPost()
 {
     $categoryMock = \Phake::mock('myfinance\\repositories\\CategoryRepository');
     $controller = new CategoryController($categoryMock);
     $json = '{"type":"1","description":"Bargeldbezug","budgetaryItem":"2"}';
     $controller->post(json_decode($json));
     \Phake::verify($categoryMock)->create(\Phake::ignoreRemaining());
 }
コード例 #29
0
 public function testPost()
 {
     $budgetaryItemRepoMock = \Phake::mock('myfinance\\repositories\\BudgetaryItemRepository');
     $controller = new BudgetaryController($budgetaryItemRepoMock);
     $json = '{"description":"Autoausgaben"}';
     $controller->post(json_decode($json));
     \Phake::verify($budgetaryItemRepoMock)->create(\Phake::ignoreRemaining());
 }
コード例 #30
0
ファイル: ApplicationsDaoTest.php プロジェクト: aainc/Behoimi
 public function testFindNoResult()
 {
     $entity = (object) array("id" => 1, "name" => "name", "client_id" => "client_id", "client_secret" => "client_secret", "application_type" => 1, "redirect_uri" => "redirect_uri", "withdraw_uri" => "withdraw_uri", "deleted_at" => 1);
     \Phake::when($this->databaseSession)->find("SELECT * FROM applications WHERE id = ?", "i", array(1))->thenReturn(array());
     $result = $this->target->find(array(1));
     \Phake::verify($this->databaseSession)->find("SELECT * FROM applications WHERE id = ?", "i", array(1));
     $this->assertSame(null, $result);
 }