Skip to content
This repository has been archived by the owner on Apr 30, 2023. It is now read-only.

test: Fixes testsuite #106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Test/Unit/Block/Pixel/HeadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class HeadTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -38,7 +38,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{

$this->context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Controller/Adminhtml/Ajax/FbaamsettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FbaamsettingsTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -34,7 +34,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(\Magento\Backend\App\Action\Context::class);
$this->resultJsonFactory = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Controller/Adminhtml/Ajax/FbdeleteassetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FbdeleteassetTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -34,7 +34,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(\Magento\Backend\App\Action\Context::class);
$this->resultJsonFactory = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Controller/Adminhtml/Ajax/FbfeedpushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FbfeedpushTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -38,7 +38,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(\Magento\Backend\App\Action\Context::class);
$this->resultJsonFactory = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Controller/Adminhtml/Ajax/FbpixelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FbpixelTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -34,7 +34,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(\Magento\Backend\App\Action\Context::class);
$this->resultJsonFactory = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Controller/Adminhtml/Ajax/FbprofilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FbprofilesTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -34,7 +34,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(\Magento\Backend\App\Action\Context::class);
$this->resultJsonFactory = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Controller/Adminhtml/Ajax/FbtokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FbtokenTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -34,7 +34,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(\Magento\Backend\App\Action\Context::class);
$this->resultJsonFactory = $this->createMock(\Magento\Framework\Controller\Result\JsonFactory::class);
Expand Down
6 changes: 3 additions & 3 deletions Test/Unit/Cron/AAMSettingsCronTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use \Facebook\BusinessExtension\Helper\FBEHelper;
use \Facebook\BusinessExtension\Cron\AAMSettingsCron;

class EventIdGeneratorTest extends \PHPUnit\Framework\TestCase
class AAMSettingsCronTest extends \PHPUnit\Framework\TestCase
{

protected $aamSettingsCron;
Expand All @@ -21,7 +21,7 @@ class EventIdGeneratorTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -30,7 +30,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->fbeHelper = $this->createMock(\Facebook\BusinessExtension\Helper\FBEHelper::class);
$this->aamSettingsCron = new \Facebook\BusinessExtension\Cron\AAMSettingsCron($this->fbeHelper);
Expand Down
10 changes: 5 additions & 5 deletions Test/Unit/Cron/CategorySyncCronTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Facebook\BusinessExtension\Model\Feed\CategoryCollection;
use Facebook\BusinessExtension\Model\System\Config as SystemConfig;

class CronRunTest extends \PHPUnit\Framework\TestCase
class CategorySyncCronTest extends \PHPUnit\Framework\TestCase
{

protected $categorySyncCron;
Expand All @@ -23,7 +23,7 @@ class CronRunTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -32,7 +32,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->fbeHelper = $this->createMock(FBEHelper::class);
$this->categoryCollection = $this->createMock(CategoryCollection::class);
Expand All @@ -51,7 +51,7 @@ public function setUp()
*/
public function testNCronDisabled()
{
$this->systemConfig->method('isActiveCollectionsSync')->willReturn(false);
$this->systemConfig->method('isActiveCatalogSync')->willReturn(false);

$result = $this->categorySyncCron->execute();

Expand All @@ -65,7 +65,7 @@ public function testNCronDisabled()
*/
public function testNCronEnabled()
{
$this->systemConfig->method('isActiveCollectionsSync')->willReturn(true);
$this->systemConfig->method('isActiveCatalogSync')->willReturn(true);

$result = $this->categorySyncCron->execute();

Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Helper/AAMFieldsExtractorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AAMFieldsExtractorHelperTest extends TestCase
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->fbeHelper = $this->createMock(FBEHelper::class);
$this->magentoDataHelper = $this->createMock(MagentoDataHelper::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Helper/EventIdGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EventIdGeneratorTest extends TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -24,7 +24,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
}

Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Helper/FBEHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FBEHelperTest extends \PHPUnit\Framework\TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -55,7 +55,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->context = $this->createMock(Context::class);
$this->objectManagerInterface = $this->createMock(ObjectManagerInterface::class);
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Helper/ServerEventFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ServerEventFactoryTest extends TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -25,7 +25,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
}

Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Helper/ServerSideHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ServerSideHelperTest extends TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -34,7 +34,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->fbeHelper = $this->createMock(FBEHelper::class);
$this->aamFieldsExtractorHelper =
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Observer/AddToCartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AddToCartTest extends CommonTest
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -30,7 +30,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
parent::setUp();
$this->request = $this->createMock(RequestInterface::class);
Expand Down
10 changes: 8 additions & 2 deletions Test/Unit/Observer/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Facebook\BusinessExtension\Helper\FBEHelper;
use Facebook\BusinessExtension\Helper\MagentoDataHelper;
use Facebook\BusinessExtension\Helper\ServerSideHelper;
use Facebook\BusinessExtension\Model\System\Config as SystemConfig;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\TestCase;

Expand All @@ -19,6 +20,8 @@ abstract class CommonTest extends TestCase

protected $fbeHelper;

protected $systemConfig;

protected $objectManager;

protected $serverSideHelper;
Expand All @@ -30,7 +33,7 @@ abstract class CommonTest extends TestCase
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -39,7 +42,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
$this->fbeHelper = $this->createMock(FBEHelper::class);
$this->magentoDataHelper = $this->createMock(MagentoDataHelper::class);
Expand All @@ -55,6 +58,9 @@ public function setUp()
$this->fbeHelper->method('getAccessToken')->willReturn('');
$this->fbeHelper->method('getPixelId')->willReturn('123');
$this->magentoDataHelper->method('getCurrency')->willReturn('USD');

$this->systemConfig = $this->createMock(SystemConfig::class);
$this->systemConfig->method('isActiveCatalogSync')->willReturn(true);
}

public function assertEqualsCustomData($customDataArray, $customData)
Expand Down
4 changes: 2 additions & 2 deletions Test/Unit/Observer/InitiateCheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class InitiateCheckoutTest extends CommonTest
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -27,7 +27,7 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
parent::setUp();
$this->initiateCheckoutObserver =
Expand Down
15 changes: 11 additions & 4 deletions Test/Unit/Observer/ProcessCategoryAfterDeleteEventObserverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ProcessCategoryAfterDeleteEventObserverTest extends CommonTest
*
* @return void
*/
public function tearDown()
public function tearDown(): void
{
}

Expand All @@ -37,16 +37,23 @@ public function tearDown()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
parent::setUp();
$this->_category = $this->createMock(Category::class);
$event = $this->createPartialMock(Event::class, ['getCategory']);
/** @var Event|MockObject */
$event = $this->getMockBuilder(Event::class)
->disableOriginalConstructor()
->addMethods(['getCategory'])
->getMock();
$event->expects($this->once())->method('getCategory')->will($this->returnValue($this->_category));
$this->_eventObserverMock = $this->createMock(\Magento\Framework\Event\Observer::class);
$this->_eventObserverMock->expects($this->once())->method('getEvent')->will($this->returnValue($event));
$this->processCategoryAfterDeleteEventObserver =
new \Facebook\BusinessExtension\Observer\ProcessCategoryAfterDeleteEventObserver($this->fbeHelper);
new \Facebook\BusinessExtension\Observer\ProcessCategoryAfterDeleteEventObserver(
$this->fbeHelper,
$this->systemConfig
);
}

public function testExcution()
Expand Down
Loading