public function testFactoryExceptionWrongInterface() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->setExpectedException('Controller_Jobs_Exception'); Controller_Jobs_Order_Cleanup_Unfinished_Factory::createController($context, $arcavias, 'Factory'); }
public function testFactoryExceptionWrongInterface() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->setExpectedException('Controller_Jobs_Exception'); $object = Controller_Jobs_Product_Import_Csv_Factory::createController($context, $arcavias, 'Factory'); }
public function testFactoryExceptionWrongInterface() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->setExpectedException('Controller_Jobs_Exception'); Controller_Jobs_Customer_Email_Watch_Factory::createController($context, $arcavias, 'Factory'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { MShop_Factory::setCache(true); $this->_context = TestHelper::getContext(); $this->_arcavias = TestHelper::getArcavias(); $this->_object = new Controller_Jobs_Product_Bought_Default($this->_context, $this->_arcavias); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->_stub = $this->getMockBuilder('Controller_Jobs_Admin_Job_Default')->setConstructorArgs(array($context, $arcavias))->getMock(); $this->_object = new Controller_Jobs_Common_Decorator_AbstractImpl($context, $arcavias, $this->_stub); }
protected function setUp() { MShop_Factory::setCache(true); $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->_object = new Controller_Common_Product_Import_Csv_TestAbstract($context, $arcavias); }
public function testFactoryExceptionWrongInterface() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->setExpectedException('Controller_Jobs_Exception'); Controller_Jobs_Catalog_Index_Rebuild_Factory::createController($context, $arcavias, 'Factory'); }
public function testImport() { $arcavias = TestHelper::getArcavias(); $cntl = Controller_Jobs_Product_Import_Csv_Factory::createController($this->_context, $arcavias, 'Default'); $start = microtime(true); $cntl->run(); $stop = microtime(true); echo "\n product import CSV: " . ($stop - $start) . " sec\n"; }
public function testRun() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $stub = $this->getMockBuilder('Controller_Jobs_Product_Suggestions_Default')->setConstructorArgs(array($this->_context, $this->_arcavias))->setMethods(array('_createProductListSuggestions', '_removeProductSuggestions'))->getMock(); $stub->expects($this->exactly(10))->method('_createProductListSuggestions')->with($this->greaterThan(0), $this->anything(), $this->equalTo($this->_getProductListTypeId()), $this->isInstanceOf('MShop_Common_Manager_Abstract')); $stub->expects($this->exactly(10))->method('_removeProductSuggestions'); $stub->run(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->_arcavias = TestHelper::getArcavias(); $this->_context = TestHelper::getContext(); $config = $this->_context->getConfig(); $config->set('controller/jobs/common/decorators/default', array()); $config->set('controller/jobs/admin/decorators/global', array()); $config->set('controller/jobs/admin/decorators/local', array()); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { MShop_Factory::setCache(true); $this->_context = TestHelper::getContext(); $this->_arcavias = TestHelper::getArcavias(); $config = $this->_context->getConfig(); $config->set('controller/jobs/product/import/csv/skip-lines', 1); $config->set('controller/jobs/product/import/csv/location', __DIR__ . '/_testfiles/valid'); $this->_object = new Controller_Jobs_Product_Import_Csv_Default($this->_context, $this->_arcavias); }
public function testGetControllers() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $list = Controller_Jobs_Factory::getControllers($context, $arcavias, TestHelper::getControllerPaths()); $this->assertGreaterThan(0, count($list)); foreach ($list as $key => $object) { $this->assertInstanceOf('Controller_Jobs_Interface', $object); } }
public function testRun() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $name = 'ControllerJobsCatalogIndexOptimizeDefaultRun'; $context->getConfig()->set('classes/catalog/manager/name', $name); $catalogManagerStub = $this->getMockBuilder('MShop_Catalog_Manager_Default')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock(); $catalogIndexManagerStub = $this->getMockBuilder('MShop_Catalog_Manager_Index_Default')->setMethods(array('optimize'))->setConstructorArgs(array($context))->getMock(); MShop_Catalog_Manager_Factory::injectManager('MShop_Catalog_Manager_' . $name, $catalogManagerStub); $catalogManagerStub->expects($this->once())->method('getSubManager')->will($this->returnValue($catalogIndexManagerStub)); $catalogIndexManagerStub->expects($this->once())->method('optimize'); $object = new Controller_Jobs_Catalog_Index_Optimize_Default($context, $arcavias); $object->run(); }
/** * @dataProvider methodProvider */ public function testRunInvalidMethod($method) { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $name = 'ControllerJobsAdminJobDefaultRun'; $context->getConfig()->set('classes/job/manager/name', $name); $object = new Controller_Jobs_Admin_Job_Default($context, $arcavias); MAdmin_Job_Manager_Factory::injectManager('MAdmin_Job_Manager_' . $name, $this->_jobManagerStub); $this->_jobManagerStub->expects($this->atLeastOnce())->method('searchItems')->will($this->onConsecutiveCalls(array($this->_jobItemStub), array())); $this->_jobManagerStub->expects($this->once())->method('saveItem'); $this->_jobItemStub->expects($this->atLeastOnce())->method('getMethod')->will($this->returnValue($method)); $this->_jobItemStub->expects($this->once())->method('setStatus')->with($this->equalTo(0)); $object->run(); }
public function testRunExceptionProcess() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $name = 'ControllerJobsServiceAsyncProcessDefaultRun'; $context->getConfig()->set('classes/service/manager/name', $name); $serviceManagerStub = $this->getMockBuilder('MShop_Service_Manager_Default')->setMethods(array('getProvider', 'searchItems'))->setConstructorArgs(array($context))->getMock(); MShop_Service_Manager_Factory::injectManager('MShop_Service_Manager_' . $name, $serviceManagerStub); $serviceItem = $serviceManagerStub->createItem(); $serviceManagerStub->expects($this->once())->method('searchItems')->will($this->onConsecutiveCalls(array($serviceItem), array())); $serviceManagerStub->expects($this->once())->method('getProvider')->will($this->throwException(new MShop_Service_Exception())); $object = new Controller_Jobs_Order_Service_Async_Default($context, $arcavias); $object->run(); }
public function testRunException() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $mailStub = $this->getMockBuilder('MW_Mail_None')->disableOriginalConstructor()->getMock(); $context->setMail($mailStub); $name = 'ControllerJobsEmailDeliveryDefaultRun'; $context->getConfig()->set('classes/order/manager/name', $name); $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock(); MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_' . $name, $orderManagerStub); $orderItem = $orderManagerStub->createItem(); $orderManagerStub->expects($this->exactly(4))->method('searchItems')->will($this->onConsecutiveCalls(array($orderItem), array(), array(), array())); $object = new Controller_Jobs_Order_Email_Delivery_Default($context, $arcavias); $object->run(); }
public function testRun() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $name = 'ControllerJobsOrderCleanupUnpaidDefaultRun'; $context->getConfig()->set('classes/order/manager/name', $name); $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('searchItems', 'getSubManager'))->setConstructorArgs(array($context))->getMock(); $orderBaseManagerStub = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setMethods(array('deleteItems'))->setConstructorArgs(array($context))->getMock(); MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_' . $name, $orderManagerStub); $orderItem = $orderManagerStub->createItem(); $orderItem->setBaseId(1); $orderItem->setId(2); $orderManagerStub->expects($this->once())->method('getSubManager')->will($this->returnValue($orderBaseManagerStub)); $orderManagerStub->expects($this->once())->method('searchItems')->will($this->returnValue(array($orderItem->getId() => $orderItem))); $orderBaseManagerStub->expects($this->once())->method('deleteItems'); $object = new Controller_Jobs_Order_Cleanup_Unpaid_Default($context, $arcavias); $object->run(); }
public function setUp() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->_object = new Controller_Jobs_TestAbstract($context, $arcavias); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->_context = TestHelper::getContext(); $this->_arcavias = TestHelper::getArcavias(); $this->_object = new Controller_Jobs_Customer_Email_Watch_Default($this->_context, $this->_arcavias); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $context = TestHelper::getContext(); $arcavias = TestHelper::getArcavias(); $this->_object = new Controller_Jobs_Admin_Cache_Default($context, $arcavias); }