Ejemplo n.º 1
0
 public function testLogout()
 {
     $this->_server->setAuth(new TestAsset\Authentication\RightPassword("testuser", "testrole"));
     $this->_acl->addRole(new Role\GenericRole("testrole"));
     $this->_acl->allow("testrole", null, null);
     $this->_server->setAcl($this->_acl);
     $resp = $this->_callServiceAuth("testuser", "");
     $this->assertTrue($resp[0]->getData() instanceof Messaging\AcknowledgeMessage);
     $this->assertContains("hello", $resp[1]->getData());
     // After logout same request should not be allowed
     $this->setUp();
     $this->_server->setAuth(new TestAsset\Authentication\RightPassword("testuser", "testrole"));
     $this->_server->setAcl($this->_acl);
     $request = new Request\StreamRequest();
     $request->setObjectEncoding(0x3);
     $this->_addLogout($request);
     $this->_addServiceCall($request);
     $this->_server->handle($request);
     $resp = $this->_server->getResponse()->getAmfBodies();
     $this->assertTrue($resp[0]->getData() instanceof Messaging\AcknowledgeMessage);
     $data = $resp[1]->getData();
     $this->assertTrue($data instanceof Messaging\ErrorMessage);
     $this->assertContains("not allowed", $data->faultString);
 }
Ejemplo n.º 2
0
 public function testCtorExcection()
 {
     $this->_server->setClass('ZendTest\\Amf\\TestAsset\\Server\\testException');
     $this->_server->setProduction(false);
     $message = new Messaging\RemotingMessage();
     $message->operation = 'hello';
     $message->source = 'ZendTest\\Amf\\TestAsset\\Server\\testException';
     $message->body = array("123");
     // create a mock message body to place th remoting message inside
     $newBody = new Value\MessageBody(null, "/1", $message);
     $request = new Request\StreamRequest();
     // at the requested service to a request
     $request->addAmfBody($newBody);
     $request->setObjectEncoding(0x3);
     // let the server handle mock request
     $this->_server->handle($request);
     $response = $this->_server->getResponse()->getAMFBodies();
     $this->assertTrue($response[0]->getData() instanceof Messaging\ErrorMessage);
     $this->assertContains("Oops, exception!", $response[0]->getData()->faultString);
 }