forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebhookControllerTest.php
More file actions
33 lines (24 loc) · 1.09 KB
/
Copy pathWebhookControllerTest.php
File metadata and controls
33 lines (24 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Tests\PHPCensor\Controller;
use PHPCensor\Controller\WebhookController;
class WebhookControllerTest extends \PHPUnit\Framework\TestCase
{
public function test_wrong_action_name_return_json_with_error()
{
$webController = new WebhookController(
$this->prophesize('PHPCensor\Config')->reveal(),
$this->prophesize('PHPCensor\Http\Request')->reveal(),
$this->prophesize('PHPCensor\Http\Response')->reveal()
);
$error = $webController->handleAction('test', []);
self::assertInstanceOf('PHPCensor\Http\Response\JsonResponse', $error);
$responseData = $error->getData();
self::assertEquals(500, $responseData['code']);
self::assertEquals('failed', $responseData['body']['status']);
self::assertEquals('application/json', $responseData['headers']['Content-Type']);
// @todo: we can't text the result is JSON file with
// self::assertJson((string) $error);
// since the flush method automatically add the header and break the
// testing framework.
}
}