DefaultControllerTest::test__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the smsmode-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\SmsModeBundle\Tests\Controller;
13
14
use WBW\Bundle\SmsModeBundle\Controller\DefaultController;
15
use WBW\Bundle\SmsModeBundle\Tests\AbstractWebTestCase;
16
17
/**
18
 * Default controller test.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Bundle\SmsModeBundle\Tests\Controller
22
 */
23
class DefaultControllerTest extends AbstractWebTestCase {
24
25
    /**
26
     * Test deliveryReportCallbackAction()
27
     *
28
     * @return void
29
     */
30
    public function testDeliveryReportCallbackAction(): void {
31
32
        $client = $this->client;
33
34
        $client->request("GET", "/delivery-report-callback?numero=33601020304&date_reception=2010-03-25+09%3A52%3A17&statut=11&smsID=S7EpYZ5kmS87&refClient=12azer34&mcc_mnc=20801");
35
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
36
        $this->assertEquals("application/json", $client->getResponse()->headers->get("Content-Type"));
37
38
        // Check the JSON response.
39
        $res = json_decode($client->getResponse()->getContent(), true);
40
41
        $this->assertArrayHasKey("code", $res);
42
        $this->assertArrayHasKey("message", $res);
43
44
        $this->assertEquals(200, $res["code"]);
45
        $this->assertEquals("OK", $res["message"]);
46
    }
47
48
    /**
49
     * Test smsReplyCallbackAction()
50
     *
51
     * @return void
52
     */
53
    public function testSmsReplyCallbackAction(): void {
54
55
        $client = $this->client;
56
57
        $client->request("GET", "/sms-reply-callback?numero=36034&message=bonjour&emetteur=33601020304&date_reception=01012013-122233&smsID=abcd1234&refClient=monclient123&responseID=azertyu123");
58
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
59
        $this->assertEquals("application/json", $client->getResponse()->headers->get("Content-Type"));
60
61
        // Check the JSON response.
62
        $res = json_decode($client->getResponse()->getContent(), true);
63
64
        $this->assertArrayHasKey("code", $res);
65
        $this->assertArrayHasKey("message", $res);
66
67
        $this->assertEquals(200, $res["code"]);
68
        $this->assertEquals("OK", $res["message"]);
69
    }
70
71
    /**
72
     * Test __construct()
73
     *
74
     * @return void
75
     */
76
    public function test__construct(): void {
77
78
        $this->assertEquals("wbw.smsmode.controller.default", DefaultController::SERVICE_NAME);
79
    }
80
}
81