Definition at line 12 of file LinksTest.php.
◆ attributesDataProvider()
attributesDataProvider |
( |
| ) |
|
- Returns
- array
Definition at line 116 of file LinksTest.php.
120 'dbAttributes' => [],
121 'returnedAttributes' => null
125 [
'code' => 2,
'id' => 6,
'type' =>
'sometable']
127 'returnedAttributes' => [
128 2 => [
'id' => 6,
'table' =>
'table_name']
133 [
'code' => 8,
'id' => 11,
'type' =>
'sometable1'],
134 [
'code' => 4,
'id' => 7,
'type' =>
'sometable2']
136 'returnedAttributes' => [
137 4 => [
'id' => 7,
'table' =>
'table_name'],
138 8 => [
'id' => 11,
'table' =>
'table_name']
◆ linksDataProvider()
- Returns
- array
Definition at line 63 of file LinksTest.php.
68 'product_ids' => [1, 2],
70 'attr_product_ids' => []
◆ processAttributeGetter()
processAttributeGetter |
( |
|
$dbAttributes | ) |
|
|
protected |
- Parameters
-
Definition at line 147 of file LinksTest.php.
150 $this->connection->expects($this->once())->method(
'select')->will($this->returnValue(
$select));
151 $select->expects($this->once())->method(
'from')->will($this->returnSelf());
152 $select->expects($this->once())->method(
'where')->will($this->returnSelf());
153 $this->connection->expects($this->once())->method(
'fetchAll')->with(
$select)->will(
154 $this->returnValue($dbAttributes)
156 $this->link->expects($this->any())->method(
'getAttributeTypeTable')->will(
157 $this->returnValue(
'table_name')
◆ processBehaviorGetter()
processBehaviorGetter |
( |
|
$behavior | ) |
|
|
protected |
- Parameters
-
Definition at line 177 of file LinksTest.php.
180 $dataSource->expects($this->once())->method(
'getBehavior')->will($this->returnValue($behavior));
181 $this->
import->expects($this->once())->method(
'getDataSourceModel')->will($this->returnValue($dataSource));
◆ setUp()
Definition at line 35 of file LinksTest.php.
38 $this->connection = $this->createMock(\
Magento\Framework\DB\Adapter\Pdo\Mysql::class);
39 $this->resource = $this->createMock(\
Magento\Framework\
App\ResourceConnection::class);
41 ->expects($this->once())
42 ->method(
'getConnection')
43 ->will($this->returnValue($this->connection));
46 $this->importFactory = $this->createPartialMock(\
Magento\
ImportExport\Model\ImportFactory::class, [
'create']);
47 $this->importFactory->expects($this->any())->method(
'create')->will($this->returnValue($this->
import));
49 $this->objectManagerHelper =
new ObjectManagerHelper($this);
50 $this->links = $this->objectManagerHelper->getObject(
51 \
Magento\GroupedImportExport\Model\Import\Product\Type\Grouped\Links::class,
53 'productLink' => $this->link,
54 'resource' => $this->resource,
55 'importFactory' => $this->importFactory
◆ testGetAttributes()
testGetAttributes |
( |
|
$dbAttributes, |
|
|
|
$returnedAttributes |
|
) |
| |
- Parameters
-
array | $dbAttributes | |
array | $returnedAttributes | @dataProvider attributesDataProvider |
Definition at line 167 of file LinksTest.php.
170 $actualAttributes = $this->links->getAttributes();
171 $this->assertEquals($returnedAttributes, $actualAttributes);
processAttributeGetter($dbAttributes)
◆ testSaveLinksDataNoProductsAttrs()
testSaveLinksDataNoProductsAttrs |
( |
|
$linksData | ) |
|
- Parameters
-
array | $linksData | @dataProvider linksDataProvider |
Definition at line 81 of file LinksTest.php.
86 $this->connection->expects($this->exactly(2))->method(
'insertOnDuplicate');
processAttributeGetter($dbAttributes)
processBehaviorGetter($behavior)
◆ testSaveLinksDataWithProductsAttrs()
testSaveLinksDataWithProductsAttrs |
( |
|
$linksData | ) |
|
- Parameters
-
array | $linksData | @dataProvider linksDataProvider |
Definition at line 95 of file LinksTest.php.
97 $linksData[
'attr_product_ids'] = [12 =>
true, 16 =>
true];
102 $this->connection->expects($this->any())->method(
'select')->will($this->returnValue(
$select));
103 $select->expects($this->any())->method(
'from')->will($this->returnSelf());
104 $select->expects($this->any())->method(
'where')->will($this->returnSelf());
105 $this->connection->expects($this->once())->method(
'fetchAll')->with(
$select)->will($this->returnValue([]));
106 $this->connection->expects($this->once())->method(
'fetchPairs')->with(
$select)->will(
107 $this->returnValue([])
109 $this->connection->expects($this->exactly(4))->method(
'insertOnDuplicate');
processBehaviorGetter($behavior)
◆ $connection
◆ $import
◆ $importFactory
◆ $link
◆ $links
◆ $objectManagerHelper
◆ $resource
The documentation for this class was generated from the following file:
- vendor/magento/module-grouped-import-export/Test/Unit/Model/Import/Product/Type/Grouped/LinksTest.php