예제 #1
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'));
 }
 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());
 }
예제 #3
0
파일: PhakeTest.php 프로젝트: kore/Phake
 /**
  * Tests that at least doesn't match
  * @expectedException Phake_Exception_VerificationException
  */
 public function testVerifyAtLeastMismatch()
 {
     $mock = Phake::mock('PhakeTest_MockedClass');
     Phake::verify($mock, Phake::atLeast(1))->foo();
 }
 /**
  * @Then /^the Adapter should report the scenario "([^"]*)" with following steps:$/
  */
 public function theAdapterShouldReportTheScenarioWithSteps($scenarioName, PyStringNode $expected_steps)
 {
     Phake::verify($this->_mockedClient, Phake::atLeast(1))->startScenario($scenarioName);
     // some steptext might be more than once in the result array
     $timesOccured = array_count_values($expected_steps->getLines());
     foreach ($expected_steps->getLines() as $steptext) {
         $times_expected = $timesOccured[$steptext];
         Phake::verify($this->_mockedClient, Phake::times($times_expected))->addStepToBuffer($steptext, null);
     }
     $this->_cntScenariosToBeStopped++;
     Phake::verify($this->_mockedClient, Phake::atLeast($this->_cntScenariosToBeStopped))->stopScenario();
 }
 /**
  * @depends test_remote_get_success_looks_up_user
  */
 public function test_remote_get_success_existing_user_sets_the_proper_cookies_and_redirects_to_admin()
 {
     Phake::when($this->facade)->get_users(Phake::anyParameters())->thenReturn(array(new WP_User(1)));
     $this->client->launchkey_callback();
     Phake::verify($this->facade)->wp_set_auth_cookie(1, false);
     Phake::verify($this->facade)->setcookie('launchkey_access_token', 'OAuth Access Token', $this->timestamp + 86400 * 30, COOKIEPATH, COOKIE_DOMAIN);
     Phake::verify($this->facade)->setcookie('launchkey_refresh_token', 'OAuth Refresh_token', $this->timestamp + 86400 * 30, COOKIEPATH, COOKIE_DOMAIN);
     Phake::verify($this->facade)->setcookie('launchkey_expires', $this->timestamp + $this->expires_in, $this->timestamp + 86400 * 30, COOKIEPATH, COOKIE_DOMAIN);
     Phake::verify($this->facade, Phake::atLeast(1))->admin_url();
     Phake::verify($this->facade)->wp_redirect('admin.url');
 }
 public function testLogsDebugMessages()
 {
     $this->loggingApiService->createWhiteLabelUser(null);
     \Phake::verify($this->logger, \Phake::atLeast(1))->debug(\Phake::anyParameters());
 }
 public function test_enqueue_wizard_script_localizes_script_after_enqueueing_scripts()
 {
     $this->wizard->enqueue_scripts();
     Phake::inOrder(Phake::verify($this->facade, Phake::atLeast(1))->wp_enqueue_script(Phake::anyParameters()), Phake::verify($this->facade)->wp_localize_script(Phake::anyParameters()));
 }
 public function testLoggerLogsDebugWhenAdded()
 {
     $this->whitelabelService = new BasicWhiteLabelService($this->apiService, $this->eventDispatcher, $this->logger);
     $this->whitelabelService->createUser("identifier");
     \Phake::verify($this->logger, \Phake::atLeast(1))->debug(\Phake::anyParameters());
 }