Skip to content

Commit

Permalink
fixed assert
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHuang committed Apr 12, 2017
1 parent 8db8166 commit c3851b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ public function testHandleRequest()
{
$app = $this->createApplication();
$response = $app->handleRequest($this->createRequest('GET', '/'));
$this->assertEquals(json_encode(['foo' => 'bar']), $response->getBody());
$this->assertEquals(json_encode(['foo' => 'bar'], TestCase::JSON_OPTION), $response->getBody());
}

public function testHandleDynamicRequest()
{
$app = $this->createApplication();
$response = $app->handleRequest($this->createRequest('GET', '/foo/bar'));
$this->assertEquals(json_encode(['foo' => 'bar']), $response->getBody());
$this->assertEquals(json_encode(['foo' => 'bar'], TestCase::JSON_OPTION), $response->getBody());
$response = $app->handleRequest($this->createRequest('GET', '/foo/foobar'));
$this->assertEquals(json_encode(['foo' => 'foobar']), $response->getBody());
$this->assertEquals(json_encode(['foo' => 'foobar'], TestCase::JSON_OPTION), $response->getBody());
}

public function testHandleMiddlewareRequest()
{
$app = $this->createApplication();
$response = $app->handleRequest($this->createRequest('POST', '/foo/bar'));
$this->assertEquals(json_encode(['foo' => 'middleware']), $response->getBody());
$this->assertEquals(json_encode(['foo' => 'middleware'], TestCase::JSON_OPTION), $response->getBody());
$response = $app->handleRequest($this->createRequest('POST', '/foo/not'));
$this->assertEquals(json_encode(['foo' => 'bar']), $response->getBody());
$this->assertEquals(json_encode(['foo' => 'bar'], TestCase::JSON_OPTION), $response->getBody());
}

public function testServiceProvider()
Expand Down Expand Up @@ -102,7 +102,7 @@ public function testAuth()
$this->assertEquals(json_encode([
'msg' => 'not allow access',
'code' => 401,
]), (string) $response->getBody());
], TestCase::JSON_OPTION), (string) $response->getBody());

$response = $app->handleRequest($this->createRequest('GET', 'http://foo:[email protected]/auth', [], null, [
'PHP_AUTH_USER' => 'foo',
Expand All @@ -113,6 +113,6 @@ public function testAuth()

$this->assertEquals(json_encode([
'foo' => 'bar',
]), (string) $response->getBody());
], TestCase::JSON_OPTION), (string) $response->getBody());
}
}
2 changes: 1 addition & 1 deletion tests/src/Testing/IndexControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testSayHello()

$response = $this->app->handleRequest($request);

$this->response($response, json_encode(['foo' => 'bar']));
$this->json($response, ['foo' => 'bar']);
}

public function testDb()
Expand Down

0 comments on commit c3851b4

Please sign in to comment.