예제 #1
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     \Aimeos\Controller\Jobs\Customer\Email\Watch\Factory::createController($context, $aimeos, 'Factory');
 }
예제 #2
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $this->context = \TestHelperJobs::getContext();
     $this->aimeos = \TestHelperJobs::getAimeos();
     $this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard($this->context, $this->aimeos);
 }
예제 #3
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     \Aimeos\Controller\Jobs\Order\Service\Payment\Factory::createController($context, $aimeos, 'Factory');
 }
예제 #4
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     $object = \Aimeos\Controller\Jobs\Product\Export\Factory::createController($context, $aimeos, 'Factory');
 }
예제 #5
0
 /**
  * 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 = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $this->stub = $this->getMockBuilder('\\Aimeos\\Controller\\Jobs\\Admin\\Job\\Standard')->setConstructorArgs(array($context, $aimeos))->getMock();
     $this->object = new TestBase($this->stub, $context, $aimeos);
 }
예제 #6
0
 public function testGetControllers()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $list = \Aimeos\Controller\Jobs\Factory::getControllers($context, $aimeos, \TestHelperJobs::getControllerPaths());
     $this->assertEquals(0, count($list));
 }
예제 #7
0
 public function testGetTypeItemNotFound()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $object = new TestAbstract($context, $aimeos);
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     $object->getTypeItemPublic('product/type', 'product', 'test');
 }
예제 #8
0
 /**
  * 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->aimeos = \TestHelperJobs::getAimeos();
     $this->context = \TestHelperJobs::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());
 }
예제 #9
0
 public function testGetControllers()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $list = \Aimeos\Controller\Jobs\Factory::getControllers($context, $aimeos, \TestHelperJobs::getControllerPaths());
     $this->assertGreaterThan(0, count($list));
     foreach ($list as $key => $object) {
         $this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $object);
     }
 }
예제 #10
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     \Aimeos\MShop\Factory::setCache(true);
     $this->context = \TestHelperJobs::getContext();
     $this->aimeos = \TestHelperJobs::getAimeos();
     $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 \Aimeos\Controller\Jobs\Product\Import\Csv\Standard($this->context, $this->aimeos);
 }
예제 #11
0
 public function testRun()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $name = 'ControllerJobsCatalogIndexOptimizeDefaultRun';
     $context->getConfig()->set('mshop/index/manager/name', $name);
     $indexManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Index\\Manager\\Standard')->setMethods(array('optimize'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Catalog\Manager\Factory::injectManager('\\Aimeos\\MShop\\Index\\Manager\\' . $name, $indexManagerStub);
     $indexManagerStub->expects($this->once())->method('optimize');
     $object = new \Aimeos\Controller\Jobs\Index\Optimize\Standard($context, $aimeos);
     $object->run();
 }
예제 #12
0
 public function testRunExceptionProcess()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $name = 'ControllerJobsServiceAsyncProcessDefaultRun';
     $context->getConfig()->set('mshop/service/manager/name', $name);
     $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')->setMethods(array('getProvider', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\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 \Aimeos\MShop\Service\Exception()));
     $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos);
     $object->run();
 }
예제 #13
0
 /**
  * @dataProvider methodProvider
  */
 public function testRunInvalidMethod($method)
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $name = 'ControllerJobsAdminJobDefaultRun';
     $context->getConfig()->set('madmin/job/manager/name', $name);
     $object = new \Aimeos\Controller\Jobs\Admin\Job\Standard($context, $aimeos);
     \Aimeos\MAdmin\Job\Manager\Factory::injectManager('\\Aimeos\\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();
 }
예제 #14
0
 public function testRunException()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $mailStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\None')->disableOriginalConstructor()->getMock();
     $context->setMail($mailStub);
     $name = 'ControllerJobsEmailDeliveryDefaultRun';
     $context->getConfig()->set('mshop/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\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 \Aimeos\Controller\Jobs\Order\Email\Delivery\Standard($context, $aimeos);
     $object->run();
 }
예제 #15
0
 public function testRun()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $name = 'ControllerJobsOrderCleanupUnpaidDefaultRun';
     $context->getConfig()->set('mshop/order/manager/name', $name);
     $context->getConfig()->set('controller/common/order/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('searchItems', 'getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setMethods(array('deleteItems'))->setConstructorArgs(array($context))->getMock();
     $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')->setMethods(array('unblock'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
     \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
     $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');
     $orderCntlStub->expects($this->once())->method('unblock');
     $object = new \Aimeos\Controller\Jobs\Order\Cleanup\Unpaid\Standard($context, $aimeos);
     $object->run();
 }
예제 #16
0
 protected function setUp()
 {
     $this->context = \TestHelperJobs::getContext('unitperf');
     $config = $this->context->getConfig();
     $config->set('controller/jobs/product/import/csv/location', 'tmp/product-import.zip');
     $config->set('controller/jobs/product/import/csv/container/type', 'Zip');
     $config->set('controller/jobs/product/import/csv/container/content', 'CSV');
     $config->set('controller/jobs/product/import/csv/mapping', $this->getMapping());
     $container = \Aimeos\MW\Container\Factory::getContainer('tmp/product-import.zip', 'Zip', 'CSV', array());
     $content = $container->create('product.csv');
     for ($i = 0; $i < 1000; $i++) {
         $data = array();
         $data = $this->addProduct($data, $i);
         $data = $this->addText($data, $i);
         $data = $this->addMedia($data, $i);
         $data = $this->addPrice($data, $i);
         $data = $this->addAttribute($data, $i);
         $data = $this->addProductRef($data, $i);
         $data = $this->addProperty($data, $i);
         $content->add($data);
     }
     $container->add($content);
     $container->close();
 }
예제 #17
0
 /**
  * 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 = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $this->object = new \Aimeos\Controller\Jobs\Admin\Cache\Standard($context, $aimeos);
 }
예제 #18
0
 /**
  * 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 = \TestHelperJobs::getContext();
     $this->aimeos = \TestHelperJobs::getAimeos();
     $this->object = new \Aimeos\Controller\Jobs\Customer\Email\Watch\Standard($this->context, $this->aimeos);
 }