public function testShouldSendNotification()
 {
     //GIVEN
     $this->_oWorker = new AM_Task_Worker_Notification_Sender_Apple();
     $this->_oWorker->addOption('message', 'Test message');
     $this->_oWorker->addOption('application_id', 11);
     $this->_oWorker->addOption('tokens', array('1e82db91c7ceddd72bf33d74ae052ac9c84a065b35148ac401388843106a7485'));
     $this->_oWorker->addOption('badge', 0);
     $this->_oWorker->create();
     //THEN
     //Checking certificates
     $this->_oStandardMock->expects($this->at(0))->method('is_readable')->with($this->equalTo('test_path/11_sandbox.pem'))->will($this->returnValue(true));
     //Connecting to APNS
     $this->_oStandardMock->expects($this->any())->method('stream_context_create')->will($this->returnValue(true));
     $this->_oStandardMock->expects($this->any())->method('stream_socket_client')->will($this->returnValue(true));
     //Sending binary notofication
     $this->_oStandardMock->expects($this->any())->method('fwrite')->will($this->returnValue(77));
     //Checking error response from apns
     $this->_oStandardMock->expects($this->any())->method('fread')->will($this->returnValue(pack('CCN', 8, 0, 1)));
     //WHEN
     try {
         $this->_oWorker->run();
     } catch (Exception $oException) {
         $this->fail($oException->getMessage());
     }
 }