1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2018 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\Controller\Frontend\Supplier; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
protected function setUp() |
18
|
|
|
{ |
19
|
|
|
$this->object = new \Aimeos\Controller\Frontend\Supplier\Standard( \TestHelperFrontend::getContext() ); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
protected function tearDown() |
24
|
|
|
{ |
25
|
|
|
unset( $this->object ); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
public function testCreateFilter() |
30
|
|
|
{ |
31
|
|
|
$filter = $this->object->createFilter(); |
32
|
|
|
|
33
|
|
|
$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
34
|
|
|
$this->assertEquals( 0, $filter->getSliceStart() ); |
35
|
|
|
$this->assertEquals( 100, $filter->getSliceSize() ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
public function testGetItem() |
40
|
|
|
{ |
41
|
|
|
$context = \TestHelperFrontend::getContext(); |
42
|
|
|
$manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
43
|
|
|
$id = $manager->findItem( 'unitCode001' )->getId(); |
44
|
|
|
|
45
|
|
|
$result = $this->object->getItem( $id ); |
46
|
|
|
|
47
|
|
|
$this->assertInstanceOf( '\Aimeos\MShop\Supplier\Item\Iface', $result ); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
public function testGetItems() |
52
|
|
|
{ |
53
|
|
|
$context = \TestHelperFrontend::getContext(); |
54
|
|
|
$manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
55
|
|
|
$id = $manager->findItem( 'unitCode001' )->getId(); |
56
|
|
|
|
57
|
|
|
$result = $this->object->getItems( [$id] ); |
58
|
|
|
|
59
|
|
|
$this->assertInternalType( 'array', $result ); |
60
|
|
|
$this->assertEquals( 1, count( $result ) ); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
|
64
|
|
|
public function testSearchItems() |
65
|
|
|
{ |
66
|
|
|
$filter = $this->object->createFilter(); |
67
|
|
|
|
68
|
|
|
$total = 0; |
69
|
|
|
$results = $this->object->searchItems( $filter, [], $total ); |
70
|
|
|
|
71
|
|
|
$this->assertEquals( 2, $total ); |
72
|
|
|
$this->assertEquals( 2, count( $results ) ); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|