Пример #1
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);
 }
Пример #2
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));
 }
Пример #3
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);
 }
Пример #4
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');
 }
Пример #5
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');
 }
Пример #6
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');
 }
Пример #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
 public static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
         self::$aimeos = new \Aimeos\Bootstrap(array(), false);
     }
     return self::$aimeos;
 }
Пример #9
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());
 }
Пример #10
0
 public function testImport()
 {
     $aimeos = \TestHelperJobs::getAimeos();
     $cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController($this->context, $aimeos, 'Standard');
     $start = microtime(true);
     $cntl->run();
     $stop = microtime(true);
     echo "\n    product import CSV: " . ($stop - $start) . " sec\n";
 }
Пример #11
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);
     }
 }
Пример #12
0
 private static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once 'Bootstrap.php';
         spl_autoload_register('Aimeos::autoload');
         $extdir = dirname(dirname(dirname(__DIR__)));
         self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
     }
     return self::$aimeos;
 }
Пример #13
0
 public static function getAimeos()
 {
     if (!isset(self::$aimeos)) {
         require_once 'Bootstrap.php';
         spl_autoload_register('Aimeos\\Bootstrap::autoload');
         $extdir = dirname(dirname(dirname(dirname(__FILE__))));
         self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
     }
     return self::$aimeos;
 }
Пример #14
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);
 }
Пример #15
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();
 }
Пример #16
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();
 }
Пример #17
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();
 }
Пример #18
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();
 }
Пример #19
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();
 }
Пример #20
0
<?php

/*
 * Set error reporting to maximum
 */
error_reporting(-1);
ini_set('display_errors', true);
date_default_timezone_set('UTC');
/*
 * Set locale settings to reasonable defaults
 */
setlocale(LC_ALL, 'en_US.UTF-8');
setlocale(LC_CTYPE, 'en_US.UTF-8');
setlocale(LC_NUMERIC, 'POSIX');
setlocale(LC_TIME, 'POSIX');
require_once 'TestHelperJobs.php';
\TestHelperJobs::bootstrap();
Пример #21
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);
 }
Пример #22
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);
 }