/** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = null) { $this->data['subscribeAttempts'] = $this->logger->getSubscribeAttempts(); $this->data['subscribeAttemptCount'] = $this->logger->countSubscribeAttempts(); $this->data['unsubscribeAttempts'] = $this->logger->getUnsubscribeAttempts(); $this->data['unsubscribeAttemptCount'] = $this->logger->countUnsubscribeAttempts(); }
public function testUnsuccessfulUnsubscribeAttemptLogged() { $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface'); $subscriptionLogger = new SubscriptionLogger($logger); $logger->expects($this->once())->method('warn'); $subscriptionLogger->logUnsubscribeAttempt(false, array('http://www.google.com')); $this->assertEquals(1, $subscriptionLogger->countUnsubscribeAttempts(), 'Incorrect number of attempts logged'); $attempts = $subscriptionLogger->getUnsubscribeAttempts(); $this->assertFalse($attempts[0]->successful, 'Attempt expected to be unsuccessful'); $this->assertEquals(array('http://www.google.com'), $attempts[0]->urls, 'Incorrect URLs stored for attempt'); }