TransferringCreditsEventTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetRequest() 0 9 1
A testSetResponse() 0 9 1
A test__construct() 0 12 1
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\Event;
13
14
use WBW\Bundle\SmsModeBundle\Event\TransferringCreditsEvent;
15
use WBW\Bundle\SmsModeBundle\Tests\AbstractTestCase;
16
use WBW\Library\SmsMode\Request\TransferringCreditsRequest;
17
use WBW\Library\SmsMode\Response\TransferringCreditsResponse;
18
19
/**
20
 * Transferring credits event test.
21
 *
22
 * @author webeweb <https://github.com/webeweb>
23
 * @package WBW\Bundle\SmsModeBundle\Tests\Event
24
 */
25
class TransferringCreditsEventTest extends AbstractTestCase {
26
27
    /**
28
     * Test setRequest()
29
     *
30
     * @return void
31
     */
32
    public function testSetRequest(): void {
33
34
        // Set a Transferring credits request mock.
35
        $request = new TransferringCreditsRequest();
36
37
        $obj = new TransferringCreditsEvent($this->transferringCredits);
38
39
        $obj->setRequest($request);
40
        $this->assertSame($request, $obj->getRequest());
41
    }
42
43
    /**
44
     * Test setResponse()
45
     *
46
     * @return void
47
     */
48
    public function testSetResponse(): void {
49
50
        // Set a Transferring credits response mock.
51
        $response = new TransferringCreditsResponse();
52
53
        $obj = new TransferringCreditsEvent($this->transferringCredits);
54
55
        $obj->setResponse($response);
56
        $this->assertSame($response, $obj->getResponse());
57
    }
58
59
    /**
60
     * Test __construct()
61
     *
62
     * @return void
63
     */
64
    public function test__construct(): void {
65
66
        $this->assertEquals("wbw.smsmode.event.transferring_credits", TransferringCreditsEvent::EVENT_NAME);
67
68
        $obj = new TransferringCreditsEvent($this->transferringCredits);
69
70
        $this->assertEquals(TransferringCreditsEvent::EVENT_NAME, $obj->getEventName());
71
72
        $this->assertNull($obj->getRequest());
73
        $this->assertNull($obj->getResponse());
74
75
        $this->assertSame($this->transferringCredits, $obj->getTransferringCredits());
76
    }
77
}
78