public function testExceptionalSender()
 {
     /** @var ShortMessageInterface|\PHPUnit_Framework_MockObject_MockObject $message */
     $message = $this->getMock('ScayTrase\\SmsDeliveryBundle\\Service\\ShortMessageInterface');
     $transport = new DummyTransport();
     $sender = new MessageDeliveryService($transport);
     self::assertFalse($sender->spoolMessage($message));
     $profile = $sender->getProfile();
     self::assertCount(1, $profile);
     self::assertEquals('Sending not configured', $profile[0]->getReason());
 }
 public function testSpoolingAndFlushing()
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|TransportInterface $transport */
     $transport = $this->getMock('ScayTrase\\SmsDeliveryBundle\\Transport\\TransportInterface');
     $transport->expects(self::any())->method('send')->willReturn(true);
     $spool = new MemorySpool();
     $sender = new MessageDeliveryService($transport, $spool);
     /** @var ShortMessageInterface|\PHPUnit_Framework_MockObject_MockObject $message */
     $message = $this->getMock('ScayTrase\\SmsDeliveryBundle\\Service\\ShortMessageInterface');
     self::assertTrue($sender->spoolMessage($message));
     $profile = $sender->getProfile();
     self::assertCount(1, $profile);
     self::assertEquals(Package::STATUS_SPOOLED, $profile[0]->getStatus());
     self::assertTrue($sender->getSpool()->flush());
     self::assertCount(1, $profile);
     self::assertEquals(Package::STATUS_SUCCESS, $profile[0]->getStatus());
 }
 public function testDataCollector()
 {
     $transport = new DummyTransport();
     /** @var MessageDeliveryService $sender */
     $sender = new MessageDeliveryService($transport, new DisabledSpool());
     $collector = new MessageDeliveryDataCollector($sender);
     /** @var ShortMessageInterface|\PHPUnit_Framework_MockObject_MockObject $message */
     $message = $this->getMock('ScayTrase\\SmsDeliveryBundle\\Service\\ShortMessageInterface');
     self::assertTrue($sender->spoolMessage($message));
     $collector->collect(new Request(), new Response());
     self::assertEquals(1, count($collector->getData()));
 }