GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

testInvokeWillCreateAnAkismetServiceInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 50
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 50
rs 9.3333
c 0
b 0
f 0
cc 1
eloc 32
nc 1
nop 0
1
<?php
2
namespace RbCommentTest\Factory\Service;
3
4
use Interop\Container\ContainerInterface;
5
use PHPUnit_Framework_TestCase;
6
use RbComment\Factory\Service\AkismetServiceFactory;
7
use Zend\View\Helper\ServerUrl;
8
use ZendService\Akismet\Akismet;
9
10
final class AkismetServiceFactoryTest extends PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @group factory
14
     */
15
    public function testInvokeWillCreateAnAkismetServiceInstance()
16
    {
17
        $containerMock = $this->createMock(ContainerInterface::class);
18
19
        $viewHelperManagerMock =
20
            $this->getMockBuilder('ViewHelperManager')
21
                 ->setMethods(['get'])
22
                 ->getMock();
23
24
        $serverUrlMock =
25
            $this->getMockBuilder(ServerUrl::class)
26
                 ->setMethods(['__invoke'])
27
                 ->getMock();
28
29
        $configMock = [
30
            'rb_comment' => [
31
                'akismet' => [
32
                    'api_key' => uniqid(),
33
                ],
34
            ],
35
        ];
36
37
        $factory = new AkismetServiceFactory();
38
39
        // Expectations
40
        $containerMock->expects($this->exactly(2))
41
                      ->method('get')
42
                      ->withConsecutive(
43
                          ['Config'],
44
                          ['ViewHelperManager']
45
                      )
46
                      ->willReturnOnConsecutiveCalls(
47
                          $configMock,
48
                          $viewHelperManagerMock
49
                      );
50
51
        $viewHelperManagerMock->expects($this->once())
52
                              ->method('get')
53
                              ->with('serverUrl')
54
                              ->willReturn($serverUrlMock);
55
56
        $serverUrlMock->expects($this->once())
57
                      ->method('__invoke')
58
                      ->willReturn('http://test.com');
59
60
        $table = $factory($containerMock, Akismet::class);
61
62
        // Assertions
63
        $this->assertInstanceOf(Akismet::class, $table);
64
    }
65
}
66