Conditions | 1 |
Paths | 1 |
Total Lines | 69 |
Code Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
37 | public function getOutput() |
||
38 | { |
||
39 | $aimeos = new \Aimeos\Shop\Base\Aimeos(); |
||
40 | $this->inject( $this->object, 'aimeos', $aimeos ); |
||
41 | |||
42 | |||
43 | $context = $this->getMockBuilder( '\Aimeos\Shop\Base\Context' ) |
||
44 | ->setMethods( array( 'get' ) ) |
||
45 | ->disableOriginalConstructor() |
||
46 | ->getMock(); |
||
47 | |||
48 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
||
49 | $ctx->setConfig( new \Aimeos\MW\Config\PHPArray() ); |
||
50 | $ctx->setLocale( new \Aimeos\MShop\Locale\Item\Standard( array( 'langid' => 'de' ) ) ); |
||
51 | |||
52 | $context->expects( $this->once() )->method( 'get' ) |
||
53 | ->will( $this->returnValue( $ctx ) ); |
||
54 | |||
55 | $this->inject( $this->object, 'context', $context ); |
||
56 | |||
57 | |||
58 | $viewContainer = $this->getMockBuilder( '\Aimeos\Shop\Base\View' ) |
||
59 | ->setMethods( array( 'create' ) ) |
||
60 | ->disableOriginalConstructor() |
||
61 | ->getMock(); |
||
62 | |||
63 | $mwView = new \Aimeos\MW\View\Standard(); |
||
64 | |||
65 | $viewContainer->expects( $this->once() )->method( 'create' ) |
||
66 | ->will( $this->returnValue( $mwView ) ); |
||
67 | |||
68 | $this->inject( $this->object, 'viewContainer', $viewContainer ); |
||
69 | |||
70 | |||
71 | $uriBuilder = $this->getMockBuilder( '\Neos\Flow\Mvc\Routing\UriBuilder' ) |
||
72 | ->disableOriginalConstructor() |
||
73 | ->getMock(); |
||
74 | |||
75 | $this->inject( $this->object, 'uriBuilder', $uriBuilder ); |
||
76 | |||
77 | |||
78 | $client = $this->getMockBuilder( '\Aimeos\Client\Html\Catalog\Lists\Standard' ) |
||
79 | ->setMethods( array( 'getBody', 'getHeader', 'process') ) |
||
80 | ->disableOriginalConstructor() |
||
81 | ->getMock(); |
||
82 | |||
83 | $client->expects( $this->once() )->method( 'getBody' ) |
||
84 | ->will( $this->returnValue( 'body' ) ); |
||
85 | |||
86 | $client->expects( $this->once() )->method( 'getHeader' ) |
||
87 | ->will( $this->returnValue( 'header' ) ); |
||
88 | |||
89 | $client->expects( $this->once() )->method( 'process' ); |
||
90 | |||
91 | \Aimeos\Client\Html\Catalog\Lists\Factory::injectClient( '\Aimeos\Client\Html\Catalog\Lists\Standard', $client ); |
||
92 | |||
93 | |||
94 | $this->view->expects( $this->once() )->method( 'assign' ) |
||
95 | ->with( $this->equalTo( 'aimeos_component_header' ), $this->equalTo( 'header' ) ); |
||
96 | |||
97 | |||
98 | $class = new \ReflectionClass( '\Aimeos\Shop\Controller\AbstractController' ); |
||
99 | $method = $class->getMethod( 'getOutput' ); |
||
100 | $method->setAccessible( true ); |
||
101 | |||
102 | |||
103 | $result = $method->invokeArgs( $this->object, array( 'catalog/lists' ) ); |
||
104 | |||
105 | $this->assertEquals( 'body', $result ); |
||
106 | } |
||
136 | } |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths