From 51b8e7c610c0c28887a5841dd358cbd89e5dc579 Mon Sep 17 00:00:00 2001 From: Raj Chevli Date: Wed, 29 Mar 2017 13:26:46 +0100 Subject: [PATCH] Remove requirements from tests --- Test/Unit/Component/WidgetsTest.php | 62 +---------------------------- composer.json | 1 - 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/Test/Unit/Component/WidgetsTest.php b/Test/Unit/Component/WidgetsTest.php index b53efbc..0e80a9e 100644 --- a/Test/Unit/Component/WidgetsTest.php +++ b/Test/Unit/Component/WidgetsTest.php @@ -3,9 +3,6 @@ namespace CtiDigital\Configurator\Test\Unit\Component; use CtiDigital\Configurator\Model\Component\Widgets; -use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; -use Magento\Framework\Data\Collection\EntityFactoryInterface; -use Magento\Framework\Event\ManagerInterface; use Magento\Store\Model\StoreFactory; use Magento\Widget\Model\ResourceModel\Widget\Instance\Collection as WidgetCollection; use Magento\Theme\Model\ResourceModel\Theme\Collection as ThemeCollection; @@ -13,39 +10,11 @@ class WidgetsTest extends ComponentAbstractTestCase { - /** - * Test 'where' condition for assertion - */ - const TEST_WHERE_CONDITION = 'condition = 1'; - protected function componentSetUp() { - $entityFactory = $this->getMock(EntityFactoryInterface::class); - $logger = $this->getMock(LoggerInterface::class); - $fetchStrategy = $this->getMock(FetchStrategyInterface::class); - $eventManager = $this->getMock(ManagerInterface::class); - - $widgetSelect = $this->getMock('Magento\Framework\DB\Select', [], [], '', false); - $themeSelect = $this->getMock('Magento\Framework\DB\Select', [], [], '', false); - $widgetSelect->expects($this->any())->method('where')->with(self::TEST_WHERE_CONDITION); - $themeSelect->expects($this->any())->method('where')->with(self::TEST_WHERE_CONDITION); - $widgetResource = $this->getResource($widgetSelect); - $themeResource = $this->getResource($themeSelect); - - $widgetArguments = array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $widgetResource); - $themeArguments = array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $themeResource); - $methods = array('getConnection'); - $storeFactory = $this->getMock(StoreFactory::class); - $widgetCollection = $this->getMockBuilder(WidgetCollection::class) - ->setConstructorArgs($widgetArguments) - ->setMethods($methods) - ->getMock(); - - $themeCollection = $this->getMockBuilder(ThemeCollection::class) - ->setConstructorArgs($themeArguments) - ->setMethods($methods) - ->getMock(); + $widgetCollection = $this->getMock(WidgetCollection::class, [], [], '', false); + $themeCollection = $this->getMock(ThemeCollection::class, [], [], '', false); $this->component = new Widgets( $this->logInterface, @@ -56,31 +25,4 @@ protected function componentSetUp() ); $this->className = Widgets::class; } - - /** - * Retrieve resource model instance - * - * @param \Magento\Framework\DB\Select $select - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function getResource(\Magento\Framework\DB\Select $select) - { - $connection = $this->getMock('Magento\Framework\DB\Adapter\Pdo\Mysql', [], [], '', false); - $connection->expects($this->once())->method('select')->will($this->returnValue($select)); - $connection->expects($this->any())->method('quoteIdentifier')->will($this->returnArgument(0)); - - $resource = $this->getMockForAbstractClass( - 'Magento\Framework\Model\ResourceModel\Db\AbstractDb', - [], - '', - false, - true, - true, - ['getConnection', 'getMainTable', 'getTable', '__wakeup'] - ); - $resource->expects($this->any())->method('getConnection')->will($this->returnValue($connection)); - $resource->expects($this->any())->method('getTable')->will($this->returnArgument(0)); - - return $resource; - } } diff --git a/composer.json b/composer.json index 5efda9f..b94dffe 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,6 @@ "php": "~5.6.0|~7.0.0", "symfony/yaml": ">2.8.0", "magento/framework": "100.1.*", - "magento/zendframework1": "1.12.16", "firegento/fastsimpleimport": "1.0.0" }, "require-dev": {