示例#1
0
 public function testPush()
 {
     $this->if($this->mockGenerator()->orphanize('__construct'))->and($this->mockClass('\\Sly\\NotificationPusher\\Adapter\\Gcm', '\\Mock'))->and($object = new \Mock\Gcm())->and($this->mockClass('\\ZendService\\Google\\Gcm\\Response', '\\Mock\\ZendService'))->and($serviceResponse = new \Mock\ZendService\Response())->and($this->mockGenerator()->orphanize('__construct'))->and($this->mockGenerator()->orphanize('open'))->and($this->mockGenerator()->orphanize('send'))->and($this->mockClass('\\ZendService\\Google\\Gcm\\Client', '\\Mock\\ZendService'))->and($serviceClient = new \Mock\ZendService\Message())->and($serviceClient->getMockController()->send = new $serviceResponse())->and($this->mockGenerator()->orphanize('__construct'))->and($this->mockClass('\\Sly\\NotificationPusher\\Model\\Push', '\\Mock'))->and($push = new \Mock\Push())->and($push->getMockController()->getMessage = new BaseMessage('Test'))->and($push->getMockController()->getDevices = new BaseDeviceCollection(array(new BaseDevice(self::GCM_TOKEN_EXAMPLE))))->and($object->getMockController()->getServiceMessageFromOrigin = new BaseServiceMessage())->and($object->getMockController()->getOpenedClient = $serviceClient)->object($object->push($push))->isInstanceOf('\\Sly\\NotificationPusher\\Collection\\DeviceCollection')->hasSize(1);
 }
 public function testPush()
 {
     $this->if($this->mockGenerator()->orphanize('__construct'))->and($this->mockClass('\\Sly\\NotificationPusher\\Adapter\\Apns', '\\Mock'))->and($apnsAdapter = new \Mock\Apns())->and($apnsAdapter->getMockController()->push = true)->and($this->mockGenerator()->orphanize('__construct'))->and($this->mockClass('\\Sly\\NotificationPusher\\Model\\Push', '\\Mock'))->and($push = new \Mock\Push())->and($push->getMockController()->getMessage = new BaseMessage('Test'))->and($push->getMockController()->getDevices = new BaseDeviceCollection(array(new BaseDevice(self::APNS_TOKEN_EXAMPLE))))->and($push->getMockController()->getAdapter = $apnsAdapter)->and($object = new TestedModel())->and($object->add($push))->object($object->push())->isInstanceOf('\\Sly\\NotificationPusher\\Collection\\PushCollection')->hasSize(1);
 }