/** * Test restore */ public function testRestore() { $this->manager->restore(Phake::anyParameters()); Phake::verify($this->strategy1)->support(Phake::anyParameters()); Phake::verify($this->strategy2)->support(Phake::anyParameters()); phake::verify($this->strategy1)->restore(Phake::anyParameters()); phake::verify($this->strategy2, Phake::never())->restore(Phake::anyParameters()); }
/** * Test restore */ public function testRemove() { $entity = Phake::mock('OpenOrchestra\\ModelInterface\\Model\\SoftDeleteableInterface'); $this->manager->remove($entity); Phake::verify($this->strategy1)->support(Phake::anyParameters()); Phake::verify($this->strategy2)->support(Phake::anyParameters()); phake::verify($this->strategy1)->remove(Phake::anyParameters()); phake::verify($this->strategy2, Phake::never())->remove(Phake::anyParameters()); }
protected function setUp() { parent::setUp(); $this->input = Phake::mock('\\Symfony\\Component\\Console\\Input\\InputInterface'); $this->output = Phake::mock('\\Symfony\\Component\\Console\\Output\\OutputInterface'); $this->connector = Phake::mock('\\Crunch\\CacheControl\\Connector'); $this->helper = Phake::mock('\\Crunch\\CacheControl\\Console\\Helper\\CacheControlHelper'); $this->subject = phake::partialMock('\\Crunch\\CacheControl\\Console\\StatusCommand'); Phake::when($this->subject)->createConnectorInstance(Phake::anyParameters())->thenReturn($this->connector); Phake::when($this->subject)->getHelper('cache-control')->thenReturn($this->helper); }
/** * @depends testCallsRequest */ public function testThrowsCommunicationErrorOnServerError() { $this->setExpectedException('\\LaunchKey\\SDK\\Service\\Exception\\CommunicationError', 'error => messages'); phake::when($this->client)->request(Phake::anyParameters())->thenReturn($this->wpError); $this->apiService->createWhiteLabelUser(null); }
/** * testSetRequest */ public function testSetRequest() { $request = \Phake::mock('Brown298\\DataTablesBundle\\Model\\RequestParameterBag'); $this->model->setRequest($request); phake::verify($request)->getEcho(); }
public function testHandleCallbackLogsWithAuthenticateTrueWhenResponseIsTrue() { $authResponse = new AuthResponse(true, "auth request authRequestId", null, null, null, null, true); Phake::when($this->apiService)->handleCallback(Phake::anyParameters())->thenReturn($authResponse); $this->authService->handleCallback(array()); phake::verify($this->apiService)->log("auth request authRequestId", "Authenticate", true); }
protected function setUp() { Phake::initAnnotations($this); Phake::when($this->wpError)->get_error_messages()->thenReturn(array('error', 'messages')); Phake::when($this->cryptService)->encryptRSA(Phake::anyParameters())->thenReturn($this->rsaEncrypted); Phake::when($this->cryptService)->sign(Phake::anyParameters())->thenReturn($this->signed); Phake::when($this->cache)->get(WordPressApiService::CACHE_KEY_PUBLIC_KEY)->thenReturn($this->publicKey); $that = $this; phake::when($this->client)->request(Phake::anyParameters())->thenReturnCallback(function () use($that) { return $that->response; }); $this->apiService = new WordPressApiService($this->client, $this->cryptService, $this->cache, $this->publicKeyTTL, $this->appKey, $this->secretKey, $this->sslverify, $this->apiBaseUrl, $this->requestTimeout); $this->loggingApiService = new WordPressApiService($this->client, $this->cryptService, $this->cache, $this->publicKeyTTL, $this->appKey, $this->secretKey, $this->sslverify, $this->apiBaseUrl, $this->requestTimeout, $this->logger); }