Completed
Push — master ( ebe5ca...36f4a7 )
by DeGracia
02:10
created

IntegrationTest::success()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace DeGraciaMathieu\Clike\Tests;
4
5
use Mockery;
6
use PHPUnit\Framework\TestCase;
7
use DeGraciaMathieu\Clike\Command;
8
9
class IntegrationTest extends TestCase {
10
    
11
    /** @test */
12
    public function success()
13
    {
14
        $command = new Command();
15
16
        $result = $command->execute(new Clear());
17
18
        $expectedArray = [
19
            [
20
                'type' => 'info',
21
                'content' => 'Output text...',
22
            ]
23
        ];
24
25
        $this->assertNotNull($result['timestamp']);        
26
        $this->assertEquals($result['lines'], $expectedArray);        
27
    }
28
29
    /** @test */
30
    public function authorized()
31
    {
32
        $command = new Command();
33
34
        $clear = Mockery::mock(new Clear())->makePartial();
35
36
        $clear->shouldReceive('authorized')->andReturn(false);        
37
38
        $result = $command->execute($clear);
39
40
        $expectedArray = [
41
            [
42
                'type' => 'error',
43
                'content' => '/clear is an unauthorized command.',
44
            ]
45
        ];
46
47
        $this->assertNotNull($result['timestamp']);        
48
        $this->assertEquals($result['lines'], $expectedArray);  
49
    }    
50
}
51