Completed
Push — master ( c2d471...c0413d )
by Aleksandar
208:47 queued 204:29
created

PostHelperTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvokingAdminUserHelperShouldReturnItSelf() 0 8 1
A testForSelectShouldReturnArray() 0 12 1
A testForWebShouldReturnArray() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Article\Test\View\Helper;
6
7
class PostHelperTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testInvokingAdminUserHelperShouldReturnItSelf()
10
    {
11
        $postService = $this->getMockBuilder('Article\Service\PostService')
12
            ->disableOriginalConstructor()
13
            ->getMockForAbstractClass();
14
        $postHelper = new \Article\View\Helper\PostHelper($postService);
15
        static::assertInstanceOf(\Article\View\Helper\PostHelper::class, $postHelper());
16
    }
17
18
    public function testForSelectShouldReturnArray()
19
    {
20
        $postService = $this->getMockBuilder('Article\Service\PostService')
21
            ->setMethods(['getForSelect'])
22
            ->disableOriginalConstructor()
23
            ->getMockForAbstractClass();
24
        $postService->expects(static::once())
25
            ->method('getForSelect')
26
            ->willReturn([]);
27
        $postHelper = new \Article\View\Helper\PostHelper($postService);
28
        static::assertSame([], $postHelper->forSelect());
29
    }
30
31
    public function testForWebShouldReturnArray()
32
    {
33
        $postService = $this->getMockBuilder('Article\Service\PostService')
34
            ->setMethods(['getLatestWeb'])
35
            ->disableOriginalConstructor()
36
            ->getMockForAbstractClass();
37
        $postService->expects(static::once())
38
            ->method('getLatestWeb')
39
            ->willReturn([]);
40
        $postHelper = new \Article\View\Helper\PostHelper($postService);
41
        static::assertSame([], $postHelper->forWeb());
42
    }
43
}
44