AccountControllerTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 70
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A historyAction() 0 13 1
A tearDown() 0 3 1
A downloadAction() 0 10 1
A setUp() 0 23 2
1
<?php
2
3
4
namespace Aimeos\Aimeos\Tests\Unit\Controller;
5
6
7
class AccountControllerTest
8
    extends \TYPO3\CMS\Core\Tests\UnitTestCase
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Core\Tests\UnitTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
{
10
    private $object;
11
12
13
    public function setUp()
14
    {
15
        \Aimeos\Aimeos\Base::aimeos(); // initialize autoloader
16
17
        $this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\AccountController', array('dummy'));
18
19
        $objManager = new \TYPO3\CMS\Extbase\Object\ObjectManager();
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Extbase\Object\ObjectManager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
21
        $uriBuilder = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
22
        $response = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
23
        $request = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
24
25
        $uriBuilder->setRequest($request);
26
27
        if (method_exists($response, 'setRequest')) {
28
            $response->setRequest($request);
29
        }
30
31
        $this->object->_set('uriBuilder', $uriBuilder);
32
        $this->object->_set('response', $response);
33
        $this->object->_set('request', $request);
34
35
        $this->object->_call('initializeAction');
36
    }
37
38
39
    public function tearDown()
40
    {
41
        unset($this->object);
42
    }
43
44
45
    /**
46
     * @test
47
     */
48
    public function downloadAction()
49
    {
50
        $name = '\\Aimeos\\Client\\Html\\Account\\Download\\Standard';
51
        $client = $this->getMock($name, array('process'), [], '', false);
52
53
        \Aimeos\Client\Html\Account\Download\Factory::injectClient($name, $client);
0 ignored issues
show
Bug introduced by
The type Aimeos\Client\Html\Account\Download\Factory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
54
        $output = $this->object->downloadAction();
55
        \Aimeos\Client\Html\Account\Download\Factory::injectClient($name, null);
56
57
        $this->assertEquals('', $output);
58
    }
59
60
61
    /**
62
     * @test
63
     */
64
    public function historyAction()
65
    {
66
        $name = '\\Aimeos\\Client\\Html\\Account\\History\\Standard';
67
        $client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false);
68
69
        $client->expects($this->once())->method('getBody')->will($this->returnValue('body'));
70
        $client->expects($this->once())->method('getHeader')->will($this->returnValue('header'));
71
72
        \Aimeos\Client\Html\Account\History\Factory::injectClient($name, $client);
0 ignored issues
show
Bug introduced by
The type Aimeos\Client\Html\Account\History\Factory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
73
        $output = $this->object->historyAction();
74
        \Aimeos\Client\Html\Account\History\Factory::injectClient($name, null);
75
76
        $this->assertEquals('body', $output);
77
    }
78
}