Passed
Push — master ( 7a5a34...fc3342 )
by Aimeos
02:30
created

StandardTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2019
6
 */
7
8
9
namespace Aimeos\Client\Html\Catalog\Detail\Supplier;
10
11
12
class StandardTest extends \PHPUnit\Framework\TestCase
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase 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...
13
{
14
	private $object;
15
16
17
	protected function setUp()
18
	{
19
		$this->context = \TestHelperHtml::getContext();
0 ignored issues
show
Bug Best Practice introduced by
The property context does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
20
		$paths = \TestHelperHtml::getHtmlTemplatePaths();
21
22
		$this->object = new \Aimeos\Client\Html\Catalog\Detail\Supplier\Standard( $this->context, $paths );
0 ignored issues
show
Unused Code introduced by
The call to Aimeos\Client\Html\Catal...Standard::__construct() has too many arguments starting with $paths. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
		$this->object = /** @scrutinizer ignore-call */ new \Aimeos\Client\Html\Catalog\Detail\Supplier\Standard( $this->context, $paths );

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
23
		$this->object->setView( \TestHelperHtml::getView() );
24
	}
25
26
27
	protected function tearDown()
28
	{
29
		unset( $this->object, $this->context );
30
	}
31
32
33
	public function testGetBody()
34
	{
35
		$tags = [];
36
		$expire = null;
37
		$view = $this->object->getView();
38
		$view->detailProductItem = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' );
39
40
		$this->object->setView( $this->object->addData( $view, $tags, $expire ) );
41
		$output = $this->object->getBody();
42
43
		$this->assertEquals( '', $output );
44
		$this->assertEquals( '2098-01-01 00:00:00', $expire );
45
		$this->assertEquals( 3, count( $tags ) );
46
47
		$rendered = $view->block()->get( 'catalog/detail/supplier' );
48
		$this->assertStringStartsWith( '<div class="catalog-detail-supplier', $rendered );
49
	}
50
51
	public function testGetSubClient()
52
	{
53
		$this->setExpectedException( '\\Aimeos\\Client\\Html\\Exception' );
54
		$this->object->getSubClient( 'invalid', 'invalid' );
55
	}
56
}
57