1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2017-2018 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\Controller\Frontend\Stock; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
private $context; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
protected function setUp() |
19
|
|
|
{ |
20
|
|
|
$this->context = \TestHelperFrontend::getContext(); |
21
|
|
|
$this->object = new \Aimeos\Controller\Frontend\Stock\Standard( $this->context ); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
protected function tearDown() |
26
|
|
|
{ |
27
|
|
|
unset( $this->object, $this->context ); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
public function testCode() |
32
|
|
|
{ |
33
|
|
|
$this->assertEquals( 2, count( $this->object->code( ['CNC', 'CNE'] )->search() ) ); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
public function testCompare() |
38
|
|
|
{ |
39
|
|
|
$this->assertEquals( 1, count( $this->object->compare( '==', 'stock.stocklevel', null )->search() ) ); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
public function testFind() |
44
|
|
|
{ |
45
|
|
|
$iface = \Aimeos\MShop\Stock\Item\Iface::class; |
46
|
|
|
$this->assertInstanceOf( $iface, $this->object->find( 'CNC', 'default' ) ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
public function testGet() |
51
|
|
|
{ |
52
|
|
|
$iface = \Aimeos\MShop\Stock\Item\Iface::class; |
53
|
|
|
$item = \Aimeos\MShop::create( $this->context, 'stock' )->findItem( 'CNC', [], 'product', 'default' ); |
54
|
|
|
|
55
|
|
|
$this->assertInstanceOf( $iface, $this->object->get( $item->getId() ) ); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
public function testParse() |
60
|
|
|
{ |
61
|
|
|
$cond = ['||' => [['==' => ['stock.dateback' => null]], ['>=' => ['stock.dateback' => '2010-01-01 00:00:00']]]]; |
62
|
|
|
$this->assertEquals( 13, count( $this->object->parse( $cond )->search() ) ); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
public function testSearch() |
67
|
|
|
{ |
68
|
|
|
$total = 0; |
69
|
|
|
$this->assertGreaterThanOrEqual( 15, count( $this->object->search( $total ) ) ); |
70
|
|
|
$this->assertGreaterThanOrEqual( 15, $total ); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
public function testSlice() |
75
|
|
|
{ |
76
|
|
|
$this->assertEquals( 2, count( $this->object->slice( 0, 2 )->search() ) ); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
|
80
|
|
|
public function testSort() |
81
|
|
|
{ |
82
|
|
|
$this->assertGreaterThanOrEqual( 15, count( $this->object->sort()->search() ) ); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
public function testSortGeneric() |
87
|
|
|
{ |
88
|
|
|
$this->assertGreaterThanOrEqual( 15, count( $this->object->sort( 'stock.dateback' )->search() ) ); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
public function testSortMultiple() |
93
|
|
|
{ |
94
|
|
|
$this->assertGreaterThanOrEqual( 15, count( $this->object->sort( 'stock.type,-stock.dateback' )->search() ) ); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
public function testSortStock() |
99
|
|
|
{ |
100
|
|
|
$result = $this->object->sort( 'stock' )->search(); |
101
|
|
|
$this->assertStringStartsWith( 'U:TEST', reset( $result )->getProductCode() ); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
|
105
|
|
|
public function testSortStockDesc() |
106
|
|
|
{ |
107
|
|
|
$result = $this->object->sort( '-stock' )->search(); |
108
|
|
|
$this->assertStringStartsWith( 'U:TEST', end( $result )->getProductCode() ); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
|
112
|
|
|
public function testType() |
113
|
|
|
{ |
114
|
|
|
$this->assertEquals( 8, count( $this->object->type( 'default' )->search() ) ); |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|
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