/**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $orderBaseManager = $orderManager->getSubManager('base');
     $this->order = $orderBaseManager->createItem();
     $orderBaseProductManager = $orderBaseManager->getSubManager('product');
     $search = $orderBaseProductManager->createSearch();
     $search->setConditions($search->combine('&&', array($search->compare('==', 'order.base.product.prodcode', array('CNE', 'CNC')), $search->compare('==', 'order.base.product.price', array('600.00', '36.00')))));
     $items = $orderBaseProductManager->searchItems($search);
     if (count($items) < 2) {
         throw new \Exception('Please fix the test data in your database.');
     }
     foreach ($items as $item) {
         $this->products[$item->getProductCode()] = $item;
     }
     $this->products['CNE']->setQuantity(2);
     $this->products['CNC']->setQuantity(1);
     $config = array('min-value' => array('EUR' => '75.00'), 'max-value' => array('EUR' => '625.00'), 'min-products' => '2', 'max-products' => 5);
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $plugin = $pluginManager->createItem();
     $plugin->setTypeId(2);
     $plugin->setProvider('BasketLimits');
     $plugin->setConfig($config);
     $plugin->setStatus('1');
     $this->object = new \Aimeos\MShop\Plugin\Provider\Order\BasketLimits(\TestHelperMShop::getContext(), $plugin);
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelper::getContext());
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setTypeId(2);
     $this->plugin->setProvider('ProductLimit');
     $this->plugin->setConfig(array('single-number-max' => 10));
     $this->plugin->setStatus('1');
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelper::getContext());
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderBaseProductManager = $orderBaseManager->getSubManager('product');
     $manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelper::getContext());
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNE', 'CNC')));
     $products = $manager->searchItems($search);
     if (count($products) !== 2) {
         throw new \Exception('Wrong number of products');
     }
     $this->products = array();
     foreach ($products as $product) {
         $item = $orderBaseProductManager->createItem();
         $item->copyFrom($product);
         $this->products[$product->getCode()] = $item;
     }
     $this->order = $orderBaseManager->createItem();
     $this->object = new \Aimeos\MShop\Plugin\Provider\Order\ProductLimit(\TestHelper::getContext(), $this->plugin);
 }
Exemple #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()
 {
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('PropertyAdd');
     $this->plugin->setStatus('1');
     $this->plugin->setConfig(array('product.stock.parentid' => array('product.stock.warehouseid', 'product.stock.editor', 'product.stock.stocklevel', 'product.stock.dateback')));
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderBaseProductManager = $orderBaseManager->getSubManager('product');
     $manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNE', 'CNC')));
     $products = $manager->searchItems($search);
     if (count($products) !== 2) {
         throw new \Exception('Wrong number of products');
     }
     $this->products = array();
     foreach ($products as $product) {
         $item = $orderBaseProductManager->createItem();
         $item->copyFrom($product);
         $this->products[$product->getCode()] = $item;
     }
     $this->order = $orderBaseManager->createItem();
     $this->object = new \Aimeos\MShop\Plugin\Provider\Order\PropertyAdd(\TestHelperMShop::getContext(), $this->plugin);
 }
 public function testSaveDeleteItem()
 {
     $manager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperExtjs::getContext());
     $typeManager = $manager->getSubManager('type');
     $search = $typeManager->createSearch();
     $search->setConditions($search->compare('==', 'plugin.type.code', 'order'));
     $result = $typeManager->searchItems($search);
     if (($type = reset($result)) === false) {
         throw new \RuntimeException('No plugin type found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('plugin.status' => 1, 'plugin.position' => 2, 'plugin.provider' => 'test provider', 'plugin.config' => array('url' => 'www.url.de'), 'plugin.typeid' => $type->getId(), 'plugin.label' => 'test plugin'));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('plugin.provider' => 'test provider')))));
     $saved = $this->object->saveItems($saveParams);
     $searched = $this->object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'plugin.id'});
     $this->object->deleteItems($deleteParams);
     $result = $this->object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'plugin.id'});
     $this->assertEquals($saved['items']->{'plugin.id'}, $searched['items'][0]->{'plugin.id'});
     $this->assertEquals($saved['items']->{'plugin.status'}, $searched['items'][0]->{'plugin.status'});
     $this->assertEquals($saved['items']->{'plugin.position'}, $searched['items'][0]->{'plugin.position'});
     $this->assertEquals($saved['items']->{'plugin.provider'}, $searched['items'][0]->{'plugin.provider'});
     $this->assertEquals($saved['items']->{'plugin.config'}, $searched['items'][0]->{'plugin.config'});
     $this->assertEquals($saved['items']->{'plugin.typeid'}, $searched['items'][0]->{'plugin.typeid'});
     $this->assertEquals($saved['items']->{'plugin.label'}, $searched['items'][0]->{'plugin.label'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
 /**
  * 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();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('ProductGone');
     $this->plugin->setStatus(1);
     $this->orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
     $orderBaseManager = $this->orderManager->getSubManager('base');
     $search = $orderBaseManager->createSearch();
     $search->setConditions($search->compare('==', 'order.base.price', 672.0));
     $search->setSlice(0, 1);
     $items = $orderBaseManager->searchItems($search);
     if (($baseItem = reset($items)) === false) {
         throw new \Exception('No order base item found.');
     }
     $this->order = $baseItem;
     // create a product to mess with in the tests
     $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelper::getContext());
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', 'CNE'));
     $search->setSlice(0, 1);
     $items = $productManager->searchItems($search);
     if (($newProduct = reset($items)) === false) {
         throw new \Exception('Product code "CNE" not found.');
     }
     $newProduct->setId(null);
     $newProduct->setLabel('Bad Product');
     $newProduct->setCode('WTF');
     $productManager->saveItem($newProduct);
     $this->product = $newProduct;
 }
Exemple #6
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 = \TestHelper::getContext();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $item = $pluginManager->createItem();
     $provider = new \Aimeos\MShop\Plugin\Provider\Order\Example($context, $item);
     $priceItem = \Aimeos\MShop\Price\Manager\Factory::createManager($context)->createItem();
     $this->order = new \Aimeos\MShop\Order\Item\Base\Standard($priceItem, $context->getLocale());
     $this->object = new \Aimeos\MShop\Plugin\Provider\Decorator\Log($context, $item, $provider);
 }
Exemple #7
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 = \TestHelperMShop::getContext();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('Coupon');
     $this->plugin->setStatus(1);
     $priceItem = \Aimeos\MShop\Price\Manager\Factory::createManager($context)->createItem();
     $this->order = new \Aimeos\MShop\Order\Item\Base\Standard($priceItem, $context->getLocale());
 }
Exemple #8
0
 protected function setUp()
 {
     $context = \TestHelperMShop::getContext();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('Autofill');
     $this->plugin->setStatus(1);
     $this->orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
     $orderBaseManager = $this->orderManager->getSubManager('base');
     $this->order = $orderBaseManager->createItem();
 }
Exemple #9
0
 protected function setUp()
 {
     $context = \TestHelperMShop::getContext();
     $this->values = array('order.base.id' => 1, 'order.base.siteid' => 99, 'order.base.customerid' => 'testuser', 'order.base.comment' => 'this is a comment from unittest', 'order.base.status' => 0, 'order.base.mtime' => '2011-01-01 00:00:02', 'order.base.ctime' => '2011-01-01 00:00:01', 'order.base.editor' => 'unitTestUser');
     $price = \Aimeos\MShop\Price\Manager\Factory::createManager($context)->createItem();
     $this->locale = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->createItem();
     $this->object = new \Aimeos\MShop\Order\Item\Base\Standard($price, $this->locale, $this->values);
     //registering order object for plugin use
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $pluginManager->register($this->object, 'order');
 }
 /**
  * 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();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setTypeId(2);
     $this->plugin->setProvider('Example');
     $this->plugin->setConfig(array('key' => 1));
     $this->plugin->setStatus('1');
     $priceItem = \Aimeos\MShop\Price\Manager\Factory::createManager($context)->createItem();
     $this->order = new \Aimeos\MShop\Order\Item\Base\Standard($priceItem, $context->getLocale());
 }
 /**
  * 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();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('ServicesAvailable');
     $this->plugin->setStatus(1);
     $orderBaseManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context)->getSubManager('base');
     $orderBaseServiceManager = $orderBaseManager->getSubManager('service');
     $this->order = $orderBaseManager->createItem();
     $this->service = $orderBaseServiceManager->createItem();
 }
 /**
  * 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 = \TestHelperMShop::getContext();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('AddressesAvailable');
     $this->plugin->setStatus(1);
     $orderBaseManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context)->getSubManager('base');
     $orderBaseAddressManager = $orderBaseManager->getSubManager('address');
     $this->order = $orderBaseManager->createItem();
     $this->address = $orderBaseAddressManager->createItem();
     $this->address->setLastName('Available');
 }
Exemple #13
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 = \TestHelperMShop::getContext();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setTypeId(2);
     $this->plugin->setProvider('Shipping');
     $this->plugin->setConfig(array('threshold' => array('EUR' => '34.00')));
     $this->plugin->setStatus('1');
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderBaseProductManager = $orderBaseManager->getSubManager('product');
     $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNE', 'CNC', 'IJKL')));
     $pResults = $manager->searchItems($search, array('price'));
     if (count($pResults) !== 3) {
         throw new \RuntimeException('Wrong number of products');
     }
     $products = array();
     foreach ($pResults as $prod) {
         $products[$prod->getCode()] = $prod;
     }
     if (($price = current($products['IJKL']->getRefItems('price'))) === false) {
         throw new \RuntimeException('No price item found');
     }
     $price->setValue(10.0);
     $this->product = $orderBaseProductManager->createItem();
     $this->product->copyFrom($products['CNE']);
     $this->product->setPrice($price);
     $product2 = $orderBaseProductManager->createItem();
     $product2->copyFrom($products['CNC']);
     $product2->setPrice($price);
     $product3 = $orderBaseProductManager->createItem();
     $product3->copyFrom($products['IJKL']);
     $product3->setPrice($price);
     $orderBaseServiceManager = $orderBaseManager->getSubManager('service');
     $serviceSearch = $orderBaseServiceManager->createSearch();
     $exp = array($serviceSearch->compare('==', 'order.base.service.type', 'delivery'), $serviceSearch->compare('==', 'order.base.service.costs', '5.00'));
     $serviceSearch->setConditions($serviceSearch->combine('&&', $exp));
     $results = $orderBaseServiceManager->searchItems($serviceSearch);
     if (($delivery = reset($results)) === false) {
         throw new \RuntimeException('No order base item found');
     }
     $this->order = $orderBaseManager->createItem();
     $this->order->setService($delivery, 'delivery');
     $this->order->addProduct($this->product);
     $this->order->addProduct($product2);
     $this->order->addProduct($product3);
     $this->object = new \Aimeos\MShop\Plugin\Provider\Order\Shipping($context, $this->plugin);
 }
 /**
  * Adds locale data.
  */
 protected function process()
 {
     $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
     if (!$this->additional instanceof $iface) {
         throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
     }
     $this->msg('Adding default plugin data', 0);
     $this->status('');
     $ds = DIRECTORY_SEPARATOR;
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($this->additional, 'Standard');
     $filename = __DIR__ . $ds . 'default' . $ds . 'data' . $ds . 'plugin.php';
     if (($data = (include $filename)) == false) {
         throw new \Aimeos\MW\Setup\Exception(sprintf('No data file "%1$s" found', $filename));
     }
     if (isset($data['plugin'])) {
         $this->addPluginData($pluginManager, $data['plugin']);
     }
 }
 public function testSaveDeleteItem()
 {
     $manager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelper::getContext());
     $typeManager = $manager->getSubManager('type');
     $search = $typeManager->createSearch();
     $search->setConditions($search->compare('==', 'plugin.type.code', 'order'));
     $result = $typeManager->searchItems($search);
     if (($type = reset($result)) === false) {
         throw new \Exception('No plugin type found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('plugin.provider' => 'test provider', 'plugin.typeid' => $type->getId()));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('plugin.provider' => 'test provider')))));
     $saved = $this->object->saveItems($saveParams);
     $this->object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'plugin.id'});
     $this->object->deleteItems($deleteParams);
     $this->object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
 }
Exemple #16
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->editor = \TestHelperMShop::getContext()->getEditor();
     $this->object = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $type = $this->object->getSubManager('type');
     $search = $type->createSearch();
     $conditions = array($search->compare('==', 'plugin.type.code', 'order'), $search->compare('==', 'plugin.type.editor', $this->editor));
     $search->setConditions($search->combine('&&', $conditions));
     $results = $type->searchItems($search);
     if (($typeItem = reset($results)) === false) {
         throw new \Exception('No item found');
     }
     $this->examplePlugin = $this->object->createItem();
     $this->examplePlugin->setTypeId($typeItem->getId());
     $this->examplePlugin->setProvider('Example');
     $this->examplePlugin->setConfig(array("limit" => "10"));
     $this->examplePlugin->setStatus(1);
     $this->examplePlugin2 = clone $this->examplePlugin;
 }
 /**
  * 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();
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($context);
     $this->plugin = $pluginManager->createItem();
     $this->plugin->setProvider('ProductPrice');
     $this->plugin->setStatus(1);
     $this->order = \Aimeos\MShop\Factory::createManager($context, 'order/base')->createItem();
     $orderBaseProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product');
     $search = $orderBaseProductManager->createSearch();
     $search->setConditions($search->compare('==', 'order.base.product.prodcode', 'CNC'));
     $productItems = $orderBaseProductManager->searchItems($search);
     if (($productItem = reset($productItems)) === false) {
         throw new \Exception('No order base product item found.');
     }
     $productItem->getPrice()->setValue(600.0);
     $productItem->getPrice()->setCosts(30.0);
     $productItem->getPrice()->setRebate(0.0);
     $productItem->getPrice()->setTaxrate(19.0);
     $this->order->addProduct($productItem);
     $this->price = clone $productItem->getPrice();
     $this->price->setValue(13.13);
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $priceManager = \Aimeos\MShop\Price\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderAddressManager = $orderBaseManager->getSubManager('address');
     $orderProductManager = $orderBaseManager->getSubManager('product');
     $orderServiceManager = $orderBaseManager->getSubManager('service');
     $this->values = array('order.base.id' => 1, 'order.base.siteid' => 99, 'order.base.customerid' => 'testuser', 'order.base.comment' => 'this is a comment from unittest', 'order.base.status' => 0, 'order.base.mtime' => '2011-01-01 00:00:02', 'order.base.ctime' => '2011-01-01 00:00:01', 'order.base.editor' => 'unitTestUser');
     $this->locale = \Aimeos\MShop\Locale\Manager\Factory::createManager(\TestHelperMShop::getContext())->createItem();
     $this->object = new \Aimeos\MShop\Order\Item\Base\Standard($priceManager->createItem(), $this->locale, $this->values);
     $price = $priceManager->createItem();
     $price->setRebate('3.01');
     $price->setValue('43.12');
     $price->setCosts('1.11');
     $price->setTaxRate('0.00');
     $price->setCurrencyId('EUR');
     $prod1 = $orderProductManager->createItem();
     $prod1->setProductCode('prod1');
     $prod1->setPrice($price);
     $price = $priceManager->createItem();
     $price->setRebate('4.00');
     $price->setValue('20.00');
     $price->setCosts('2.00');
     $price->setTaxRate('0.50');
     $price->setCurrencyId('EUR');
     $prod2 = $orderProductManager->createItem();
     $prod2->setProductCode('prod2');
     $prod2->setPrice($price);
     $this->products = array($prod1, $prod2);
     $this->coupons = array('OPQR' => array($prod1));
     $this->addresses = array(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT => $orderAddressManager->createItem(), \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY => $orderAddressManager->createItem());
     $this->services = array('payment' => $orderServiceManager->createItem(), 'delivery' => $orderServiceManager->createItem());
     //registering order object for plugin use
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $pluginManager->register($this->object, 'order');
 }
Exemple #19
0
 protected function setUp()
 {
     $context = \TestHelperMShop::getContext();
     $priceManager = \Aimeos\MShop\Price\Manager\Factory::createManager($context);
     $locale = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->createItem();
     $this->object = new \Aimeos\MShop\Order\Item\Base\Standard($priceManager->createItem(), $locale, array());
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderAddressManager = $orderBaseManager->getSubManager('address');
     $orderProductManager = $orderBaseManager->getSubManager('product');
     $orderServiceManager = $orderBaseManager->getSubManager('service');
     $price = $priceManager->createItem();
     $price->setRebate('3.01');
     $price->setValue('43.12');
     $price->setCosts('1.11');
     $price->setTaxRate('0.00');
     $price->setCurrencyId('EUR');
     $prod1 = $orderProductManager->createItem();
     $prod1->setProductCode('prod1');
     $prod1->setPrice($price);
     $price = $priceManager->createItem();
     $price->setRebate('4.00');
     $price->setValue('20.00');
     $price->setCosts('2.00');
     $price->setTaxRate('0.50');
     $price->setCurrencyId('EUR');
     $prod2 = $orderProductManager->createItem();
     $prod2->setProductCode('prod2');
     $prod2->setPrice($price);
     $this->products = array($prod1, $prod2);
     $this->coupons = array('OPQR' => array($prod1));
     $this->addresses = array(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT => $orderAddressManager->createItem(), \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY => $orderAddressManager->createItem());
     $this->services = array('payment' => $orderServiceManager->createItem(), 'delivery' => $orderServiceManager->createItem());
     //registering order object for plugin use
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext());
     $pluginManager->register($this->object, 'order');
 }
 /**
  * Adds the plugin test data.
  *
  * @throws \Aimeos\MW\Setup\Exception If no type ID is found
  */
 private function addPluginData()
 {
     $pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager($this->additional, 'Standard');
     $pluginTypeManager = $pluginManager->getSubManager('type', 'Standard');
     $ds = DIRECTORY_SEPARATOR;
     $path = __DIR__ . $ds . 'data' . $ds . 'plugin.php';
     if (($testdata = (include $path)) == false) {
         throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for plugin domain', $path));
     }
     $plugTypeIds = array();
     $type = $pluginTypeManager->createItem();
     $this->conn->begin();
     foreach ($testdata['plugin/type'] as $key => $dataset) {
         $type->setId(null);
         $type->setCode($dataset['code']);
         $type->setLabel($dataset['label']);
         $type->setDomain($dataset['domain']);
         $type->setStatus($dataset['status']);
         $pluginTypeManager->saveItem($type);
         $plugTypeIds[$key] = $type->getId();
     }
     $plugin = $pluginManager->createItem();
     foreach ($testdata['plugin'] as $dataset) {
         if (!isset($plugTypeIds[$dataset['typeid']])) {
             throw new \Aimeos\MW\Setup\Exception(sprintf('No plugin type ID found for "%1$s"', $dataset['typeid']));
         }
         $plugin->setId(null);
         $plugin->setTypeId($plugTypeIds[$dataset['typeid']]);
         $plugin->setLabel($dataset['label']);
         $plugin->setStatus($dataset['status']);
         $plugin->setConfig($dataset['config']);
         $plugin->setProvider($dataset['provider']);
         $pluginManager->saveItem($plugin, false);
     }
     $this->conn->commit();
 }
 /**
  * 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->editor = \TestHelper::getContext()->getEditor();
     $manager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelper::getContext());
     $this->object = $manager->getSubManager('type');
 }
Exemple #22
0
 public function testCreateManagerNotExisting()
 {
     $this->setExpectedException('\\Aimeos\\MShop\\Exception');
     \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext(), 'unknown');
 }