Skip to content

Commit

Permalink
Updated unit & functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Schuermans committed Jan 7, 2016
1 parent 9aee619 commit 44f862c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/functional/RequestFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function testConcatRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertEquals(null, $response->getRpcErrorCode());
$this->assertEquals(null, $response->getRpcErrorMessage());
$this->assertEquals(null, $response->getRpcErrorData());
}

public function testConcatAsyncRequest()
Expand All @@ -69,6 +70,7 @@ public function testConcatAsyncRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertEquals(null, $response->getRpcErrorCode());
$this->assertEquals(null, $response->getRpcErrorMessage());
$this->assertEquals(null, $response->getRpcErrorData());
});
}

Expand All @@ -90,6 +92,7 @@ public function testSumRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertEquals(null, $response->getRpcErrorCode());
$this->assertEquals(null, $response->getRpcErrorMessage());
$this->assertEquals(null, $response->getRpcErrorData());
}

public function testSumAsyncRequest()
Expand All @@ -111,6 +114,7 @@ public function testSumAsyncRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertEquals(null, $response->getRpcErrorCode());
$this->assertEquals(null, $response->getRpcErrorMessage());
$this->assertEquals(null, $response->getRpcErrorData());
});
}

Expand All @@ -131,6 +135,7 @@ public function testFooRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertEquals(null, $response->getRpcErrorCode());
$this->assertEquals(null, $response->getRpcErrorMessage());
$this->assertEquals(null, $response->getRpcErrorData());
}

public function testFooAsyncRequest()
Expand All @@ -151,6 +156,7 @@ public function testFooAsyncRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertEquals(null, $response->getRpcErrorCode());
$this->assertEquals(null, $response->getRpcErrorMessage());
$this->assertEquals(null, $response->getRpcErrorData());
});
}

Expand All @@ -171,6 +177,7 @@ public function testBarRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertTrue(is_int($response->getRpcErrorCode()));
$this->assertTrue(is_string($response->getRpcErrorMessage()));
$this->assertEquals(null, $response->getRpcErrorData());
}

public function testBarAsyncRequest()
Expand All @@ -191,6 +198,7 @@ public function testBarAsyncRequest()
$this->assertEquals($id, $response->getRpcId());
$this->assertTrue(is_int($response->getRpcErrorCode()));
$this->assertTrue(is_string($response->getRpcErrorMessage()));
$this->assertEquals(null, $response->getRpcErrorData());
});
}

Expand Down
16 changes: 16 additions & 0 deletions test/unit/Message/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ public function testGetRpcErrorMessageIsNull()
$this->assertNull($response->getRpcErrorCode());
}

public function testGetRpcErrorData()
{
$response = new Response(200, [], json_encode([
'error' => ['data' => array()]
]));

$this->assertEquals(array(), $response->getRpcErrorMessage());
}

public function testGetRpcErrorDataIsNull()
{
$response = new Response(200);

$this->assertNull($response->getRpcErrorData());
}

public function testGetRpcResult()
{
$response = new Response(200, [], json_encode([
Expand Down

0 comments on commit 44f862c

Please sign in to comment.