public function testServerResponse() { $client = new Client('http://localhost/simple-encrypted-api/test/mock/server.php', $this->encryption_key); $request = array("action" => "save", "object" => array("name" => "mock object")); $response = $client->sendRequest($request); $this->assertArrayHasKey('request', $response); }
public function testEncodeDecodeArray() { $client = new Client('http://localhost', $this->encryption_key); $server = new Server($this->encryption_key); $request = array("action" => "save", "object" => array("name" => "mock object")); $encoded = $client->encodeRequest($request); $decoded = $server->decodeRequest($encoded); $this->assertArrayHasKey('action', $decoded); $this->assertEquals($decoded['action'], "save"); $this->assertEquals($decoded['object']['name'], "mock object"); }