Skip to content

Commit 4cafe7f

Browse files
authored
Move MagentoDataHelper to the Conversion module (#155)
* move MagentoDataHelper to the Conversion module * update module dependencies * fix tests * fix tests
1 parent 353290f commit 4cafe7f

27 files changed

+97
-51
lines changed

app/code/Meta/BusinessExtension/composer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@
99
"magento/framework": "*",
1010
"magento/module-backend": "*",
1111
"magento/module-catalog": "*",
12-
"magento/module-configurable-product": "*",
1312
"magento/module-config": "*",
1413
"magento/module-security": "*",
1514
"magento/module-store": "*",
1615
"magento/module-newsletter": "*",
17-
"magento/module-customer": "*",
18-
"magento/module-checkout": "*",
19-
"magento/module-directory": "*",
20-
"magento/module-eav": "*",
16+
"meta/module-sales": "*",
2117
"facebook/php-business-sdk": "^15.0.0"
2218
},
2319
"autoload": {

app/code/Meta/BusinessExtension/etc/module.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
<sequence>
66
<module name="Magento_Backend"/>
77
<module name="Magento_Catalog"/>
8-
<module name="Magento_ConfigurableProduct"/>
98
<module name="Magento_Config"/>
109
<module name="Magento_Security"/>
1110
<module name="Magento_Store"/>
1211
<module name="Magento_Newsletter"/>
13-
<module name="Magento_Customer"/>
14-
<module name="Magento_Checkout"/>
15-
<module name="Magento_Directory"/>
16-
<module name="Magento_Eav"/>
12+
<module name="Meta_Sales"/>
1713
</sequence>
1814
</module>
1915
</config>

app/code/Meta/Catalog/Test/Unit/Observer/ProcessCategoryAfterDeleteEventObserverTest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,30 @@
1818
namespace Meta\Catalog\Test\Unit\Observer;
1919

2020
use Magento\Framework\Event\Observer;
21+
use Meta\BusinessExtension\Helper\FBEHelper;
22+
use Meta\BusinessExtension\Model\System\Config;
2123
use Meta\Catalog\Model\Feed\CategoryCollection;
22-
use Meta\BusinessExtension\Test\Unit\Observer\CommonTest;
2324
use Magento\Catalog\Model\Category;
2425
use Magento\Framework\Event;
2526
use Meta\Catalog\Observer\ProcessCategoryAfterDeleteEventObserver;
27+
use PHPUnit\Framework\TestCase;
2628
use PHPUnit\Framework\MockObject\MockObject;
2729

28-
class ProcessCategoryAfterDeleteEventObserverTest extends CommonTest
30+
class ProcessCategoryAfterDeleteEventObserverTest extends TestCase
2931
{
32+
/**
33+
* @var MockObject
34+
*/
35+
private MockObject $fbeHelper;
36+
37+
/**
38+
* @var MockObject
39+
*/
40+
private MockObject $systemConfig;
41+
42+
/**
43+
* @var ProcessCategoryAfterDeleteEventObserver
44+
*/
3045
private $processCategoryAfterDeleteEventObserver;
3146

3247
/**
@@ -46,7 +61,8 @@ class ProcessCategoryAfterDeleteEventObserverTest extends CommonTest
4661
*/
4762
public function setUp(): void
4863
{
49-
parent::setUp();
64+
$this->fbeHelper = $this->createMock(FBEHelper::class);
65+
$this->systemConfig = $this->createMock(Config::class);
5066
$this->_category = $this->createMock(Category::class);
5167
$event = $this->getMockBuilder(Event::class)->addMethods(['getCategory'])->getMock();
5268
$event->expects($this->once())->method('getCategory')->will($this->returnValue($this->_category));

app/code/Meta/Catalog/Test/Unit/Observer/ProcessCategoryAfterSaveEventObserverTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@
1818
namespace Meta\Catalog\Test\Unit\Observer;
1919

2020
use Magento\Framework\Event;
21-
use Meta\BusinessExtension\Test\Unit\Observer\CommonTest;
21+
use Meta\BusinessExtension\Helper\FBEHelper;
2222
use Meta\Catalog\Model\Feed\CategoryCollection;
2323
use Meta\Catalog\Observer\ProcessCategoryAfterSaveEventObserver;
24+
use PHPUnit\Framework\TestCase;
25+
use PHPUnit\Framework\MockObject\MockObject;
2426

25-
class ProcessCategoryAfterSaveEventObserverTest extends CommonTest
27+
class ProcessCategoryAfterSaveEventObserverTest extends TestCase
2628
{
27-
protected $processCategoryAfterSaveEventObserver;
29+
/**
30+
* @var MockObject
31+
*/
32+
private MockObject $fbeHelper;
33+
34+
private $processCategoryAfterSaveEventObserver;
2835

2936
/**
3037
* @var \PHPUnit\Framework\MockObject\MockObject
@@ -43,7 +50,7 @@ class ProcessCategoryAfterSaveEventObserverTest extends CommonTest
4350
*/
4451
public function setUp(): void
4552
{
46-
parent::setUp();
53+
$this->fbeHelper = $this->createMock(FBEHelper::class);
4754
$this->_category = $this->createMock(\Magento\Catalog\Model\Category::class);
4855
$event = $this->getMockBuilder(Event::class)->addMethods(['getCategory'])->getMock();
4956
$event->expects($this->once())->method('getCategory')->will($this->returnValue($this->_category));

app/code/Meta/Catalog/Test/Unit/Observer/ProcessProductAfterDeleteEventObserverTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,33 @@
1717

1818
namespace Meta\Catalog\Test\Unit\Observer;
1919

20+
use Meta\BusinessExtension\Helper\FBEHelper;
2021
use Meta\BusinessExtension\Helper\GraphAPIAdapter;
21-
use Meta\BusinessExtension\Test\Unit\Observer\CommonTest;
22+
use Meta\BusinessExtension\Model\System\Config;
2223
use Meta\Catalog\Helper\Product\Identifier;
2324
use Meta\Catalog\Observer\Product\DeleteAfter as ProcessProductAfterDeleteEventObserver;
2425
use Magento\Catalog\Model\Product;
2526
use Magento\Framework\Event;
2627
use Magento\Framework\Event\Observer;
28+
use PHPUnit\Framework\TestCase;
2729
use PHPUnit\Framework\MockObject\MockObject;
2830

29-
class ProcessProductAfterDeleteEventObserverTest extends CommonTest
31+
class ProcessProductAfterDeleteEventObserverTest extends TestCase
3032
{
33+
/**
34+
* @var MockObject
35+
*/
36+
private MockObject $fbeHelper;
37+
38+
/**
39+
* @var MockObject
40+
*/
41+
private MockObject $systemConfig;
42+
3143
/**
3244
* @var ProcessProductAfterDeleteEventObserver
3345
*/
34-
protected $processProductAfterDeleteEventObserver;
46+
private $processProductAfterDeleteEventObserver;
3547

3648
/**
3749
* @var MockObject
@@ -60,7 +72,8 @@ class ProcessProductAfterDeleteEventObserverTest extends CommonTest
6072
*/
6173
public function setUp(): void
6274
{
63-
parent::setUp();
75+
$this->fbeHelper = $this->createMock(FBEHelper::class);
76+
$this->systemConfig = $this->createMock(Config::class);
6477
$this->_product = $this->createMock(Product::class);
6578
$this->_product->expects($this->atLeastOnce())->method('getId')->will($this->returnValue("1234"));
6679
$this->_product->expects($this->never())->method('getSku');

app/code/Meta/Catalog/Test/Unit/Observer/ProcessProductAfterSaveEventObserverTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,34 @@
1717

1818
namespace Meta\Catalog\Test\Unit\Observer;
1919

20+
use Meta\BusinessExtension\Helper\FBEHelper;
2021
use Meta\BusinessExtension\Helper\GraphAPIAdapter;
21-
use Meta\BusinessExtension\Test\Unit\Observer\CommonTest;
22+
use Meta\BusinessExtension\Model\System\Config;
2223
use Meta\Catalog\Model\Product\Feed\Method\BatchApi;
2324
use Meta\Catalog\Observer\Product\SaveAfter as ProcessProductAfterSaveEventObserver;
2425
use Magento\Catalog\Model\Product;
2526
use Magento\Framework\Event;
2627
use Magento\Framework\Event\Observer;
2728
use Magento\Store\Api\Data\StoreInterface;
29+
use PHPUnit\Framework\TestCase;
2830
use PHPUnit\Framework\MockObject\MockObject;
2931

30-
class ProcessProductAfterSaveEventObserverTest extends CommonTest
32+
class ProcessProductAfterSaveEventObserverTest extends TestCase
3133
{
34+
/**
35+
* @var MockObject
36+
*/
37+
private MockObject $fbeHelper;
38+
39+
/**
40+
* @var MockObject
41+
*/
42+
private MockObject $systemConfig;
43+
3244
/**
3345
* @var ProcessProductAfterSaveEventObserver
3446
*/
35-
protected $processProductAfterSaveEventObserver;
47+
private $processProductAfterSaveEventObserver;
3648

3749
/**
3850
* @var MockObject
@@ -66,7 +78,8 @@ class ProcessProductAfterSaveEventObserverTest extends CommonTest
6678
*/
6779
public function setUp(): void
6880
{
69-
parent::setUp();
81+
$this->fbeHelper = $this->createMock(FBEHelper::class);
82+
$this->systemConfig = $this->createMock(Config::class);
7083
$this->store = $this->createMock(StoreInterface::class);
7184
$this->fbeHelper->expects($this->once())->method('getStore')->will($this->returnValue($this->store));
7285
$this->_product = $this->createMock(Product::class);

app/code/Meta/Catalog/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"magento/module-backend": "*",
1212
"magento/module-catalog": "*",
1313
"magento/module-configurable-product": "*",
14-
"magento/module-catalog-inventory": "*",
1514
"magento/module-config": "*",
15+
"magento/module-customer": "*",
1616
"magento/module-eav": "*",
1717
"magento/module-store": "*",
1818
"meta/module-business-extension": "*"

app/code/Meta/Catalog/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<module name="Magento_Catalog"/>
77
<module name="Magento_ConfigurableProduct"/>
88
<module name="Magento_Config"/>
9-
<module name="Magento_CatalogInventory"/>
9+
<module name="Magento_Customer"/>
1010
<module name="Magento_Inventory"/>
1111
<module name="Magento_InventoryApi"/>
1212
<module name="Magento_InventorySalesApi"/>

app/code/Meta/Conversion/Block/Pixel/Common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace Meta\Conversion\Block\Pixel;
1919

2020
use Meta\BusinessExtension\Helper\FBEHelper;
21-
use Meta\BusinessExtension\Helper\MagentoDataHelper;
21+
use Meta\Conversion\Helper\MagentoDataHelper;
2222
use Meta\BusinessExtension\Model\System\Config as SystemConfig;
2323
use Magento\Catalog\Model\Product;
2424
use Magento\Framework\ObjectManagerInterface;

app/code/Meta/Conversion/Block/Pixel/Head.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Magento\Framework\Escaper;
2121
use Meta\Conversion\Helper\AAMFieldsExtractorHelper;
2222
use Meta\BusinessExtension\Helper\FBEHelper;
23-
use Meta\BusinessExtension\Helper\MagentoDataHelper;
23+
use Meta\Conversion\Helper\MagentoDataHelper;
2424
use Meta\BusinessExtension\Model\System\Config as SystemConfig;
2525
use Magento\Framework\ObjectManagerInterface;
2626
use Magento\Framework\View\Element\Template\Context;

0 commit comments

Comments
 (0)