Пример #1
0
 /**
  * _testFile
  *
  * @dataProvider testProvider
  *
  * @param string $file
  * @param string $standard
  * @param boolean $expectPass
  */
 public function testFile($file, $standard, $expectPass)
 {
     $outputStr = $this->helper->runPhpCs($file, $standard);
     if ($expectPass) {
         $this->assertNotRegExp("/FOUND \\d+ ERROR/", $outputStr, basename($file) . ' - expected to pass with no errors, some were reported. ');
     } else {
         $this->assertRegExp("/FOUND \\d+ ERROR/", $outputStr, basename($file) . ' - expected failures, none reported. ');
     }
 }
Пример #2
0
 public function testSaveDeleteItem()
 {
     $manager = \Aimeos\MShop\Attribute\Manager\Factory::createManager(\TestHelper::getContext());
     $typeManager = $manager->getSubManager('type');
     $criteria = $typeManager->createSearch();
     $criteria->setSlice(0, 1);
     $result = $typeManager->searchItems($criteria);
     if (($type = reset($result)) === false) {
         throw new \Exception('No type item found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('attribute.typeid' => $type->getId(), 'attribute.domain' => 'product', 'attribute.code' => 'test', 'attribute.label' => 'test label', 'attribute.position' => 1, 'attribute.status' => 0));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('attribute.code' => 'test')))));
     $saved = $this->object->saveItems($saveParams);
     $searched = $this->object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => array($saved['items']->{'attribute.id'}));
     $this->object->deleteItems($deleteParams);
     $result = $this->object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'attribute.id'});
     $this->assertEquals($saved['items']->{'attribute.id'}, $searched['items'][0]->{'attribute.id'});
     $this->assertEquals($saved['items']->{'attribute.typeid'}, $searched['items'][0]->{'attribute.typeid'});
     $this->assertEquals($saved['items']->{'attribute.domain'}, $searched['items'][0]->{'attribute.domain'});
     $this->assertEquals($saved['items']->{'attribute.code'}, $searched['items'][0]->{'attribute.code'});
     $this->assertEquals($saved['items']->{'attribute.label'}, $searched['items'][0]->{'attribute.label'});
     $this->assertEquals($saved['items']->{'attribute.position'}, $searched['items'][0]->{'attribute.position'});
     $this->assertEquals($saved['items']->{'attribute.status'}, $searched['items'][0]->{'attribute.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Пример #3
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->_editor = TestHelper::getContext()->getEditor();
     $manager = MShop_Customer_Manager_Factory::createManager(TestHelper::getContext(), 'FosUser');
     $listManager = $manager->getSubManager('list', 'FosUser');
     $this->_object = $listManager->getSubManager('type', 'FosUser');
 }
Пример #4
0
 public function testSaveDeleteItem()
 {
     $controller = Controller_ExtJS_Price_Type_Factory::createController(TestHelper::getContext());
     $params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array((object) array('==' => (object) array('price.type.domain' => 'product')), (object) array('==' => (object) array('price.type.code' => 'default')))));
     $result = $controller->searchItems($params);
     if (($priceItem = reset($result['items'])) === false) {
         throw new Exception('No type item found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('price.typeid' => $priceItem->{'price.type.id'}, 'price.domain' => 'product', 'price.currencyid' => 'EUR', 'price.quantity' => '10', 'price.value' => '49.00', 'price.costs' => '5.00', 'price.rebate' => '10.00', 'price.taxrate' => '20.00', 'price.status' => 0));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('price.value' => '49.00')))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'price.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'price.id'});
     $this->assertEquals($saved['items']->{'price.id'}, $searched['items'][0]->{'price.id'});
     $this->assertEquals($saved['items']->{'price.typeid'}, $searched['items'][0]->{'price.typeid'});
     $this->assertEquals($saved['items']->{'price.domain'}, $searched['items'][0]->{'price.domain'});
     $this->assertEquals($saved['items']->{'price.currencyid'}, $searched['items'][0]->{'price.currencyid'});
     $this->assertEquals($saved['items']->{'price.quantity'}, $searched['items'][0]->{'price.quantity'});
     $this->assertEquals($saved['items']->{'price.value'}, $searched['items'][0]->{'price.value'});
     $this->assertEquals($saved['items']->{'price.costs'}, $searched['items'][0]->{'price.costs'});
     $this->assertEquals($saved['items']->{'price.rebate'}, $searched['items'][0]->{'price.rebate'});
     $this->assertEquals($saved['items']->{'price.taxrate'}, $searched['items'][0]->{'price.taxrate'});
     $this->assertEquals($saved['items']->{'price.status'}, $searched['items'][0]->{'price.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Пример #5
0
 public function testSaveDeleteItem()
 {
     $manager = MShop_Order_Manager_Factory::createManager(TestHelper::getContext());
     $baseManager = $manager->getSubManager('base');
     $productManager = $baseManager->getSubManager('product');
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'order.base.product.prodcode', 'CNE'));
     $results = $productManager->searchItems($search);
     if (($expected = reset($results)) === false) {
         throw new Exception('No product item found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('order.base.product.attribute.productid' => $expected->getId(), 'order.base.product.attribute.code' => 'color', 'order.base.product.attribute.value' => 'purple', 'order.base.product.attribute.name' => 'Lila'));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('order.base.product.attribute.name' => 'Lila')))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'order.base.product.attribute.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'order.base.product.attribute.id'});
     $this->assertEquals($saved['items']->{'order.base.product.attribute.id'}, $searched['items'][0]->{'order.base.product.attribute.id'});
     $this->assertEquals($saved['items']->{'order.base.product.attribute.code'}, $searched['items'][0]->{'order.base.product.attribute.code'});
     $this->assertEquals($saved['items']->{'order.base.product.attribute.value'}, $searched['items'][0]->{'order.base.product.attribute.value'});
     $this->assertEquals($saved['items']->{'order.base.product.attribute.name'}, $searched['items'][0]->{'order.base.product.attribute.name'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Пример #6
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelper::getContext();
     $this->editor = $this->context->getEditor();
     $manager = \Aimeos\MShop\Price\Manager\Factory::createManager($this->context, 'Standard');
     $this->object = $manager->getSubManager('lists', 'Standard');
 }
Пример #7
0
 /**
  * Sets up the fixture, especially creates products.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $orderProducts = array();
     $context = \TestHelper::getContext();
     $this->couponItem = \Aimeos\MShop\Coupon\Manager\Factory::createManager($context)->createItem();
     $provider = new \Aimeos\MShop\Coupon\Provider\Example($context, $this->couponItem, 'abcd');
     $this->object = new \Aimeos\MShop\Coupon\Provider\Decorator\Required($context, $this->couponItem, 'abcd', $provider);
     $this->object->setObject($this->object);
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderProductManager = $orderBaseManager->getSubManager('product');
     $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNC')));
     $products = $productManager->searchItems($search);
     $priceManager = \Aimeos\MShop\Price\Manager\Factory::createManager($context);
     $price = $priceManager->createItem();
     $price->setValue(321);
     foreach ($products as $product) {
         $orderProduct = $orderProductManager->createItem();
         $orderProduct->copyFrom($product);
         $orderProducts[$product->getCode()] = $orderProduct;
     }
     $orderProducts['CNC']->setPrice($price);
     $this->orderBase = new \Aimeos\MShop\Order\Item\Base\Standard($priceManager->createItem(), $context->getLocale());
     $this->orderBase->addProduct($orderProducts['CNC']);
 }
Пример #8
0
 public function testSaveDeleteItem()
 {
     $params = (object) array('site' => 'unittest', 'limit' => 1);
     $textManager = new Controller_ExtJS_Supplier_Default(TestHelper::getContext());
     $result = $textManager->searchItems($params);
     $params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('supplier.list.type.domain' => 'text')))), 'start' => 0, 'limit' => 1);
     $listTypeManager = Controller_ExtJS_Supplier_List_Type_Factory::createController(TestHelper::getContext());
     $resultType = $listTypeManager->searchItems($params);
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('supplier.list.parentid' => $result['items'][0]->{'supplier.id'}, 'supplier.list.typeid' => $resultType['items'][0]->{'supplier.list.type.id'}, 'supplier.list.domain' => 'supplier', 'supplier.list.refid' => -1, 'supplier.list.datestart' => '2000-01-01 00:00:00', 'supplier.list.dateend' => '2001-01-01 00:00:00', 'supplier.list.config' => array('test' => 'unit'), 'supplier.list.position' => 1, 'supplier.list.status' => 1));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('supplier.list.refid' => -1)))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'supplier.list.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'supplier.list.id'});
     $this->assertEquals($saved['items']->{'supplier.list.id'}, $searched['items'][0]->{'supplier.list.id'});
     $this->assertEquals($saved['items']->{'supplier.list.parentid'}, $searched['items'][0]->{'supplier.list.parentid'});
     $this->assertEquals($saved['items']->{'supplier.list.typeid'}, $searched['items'][0]->{'supplier.list.typeid'});
     $this->assertEquals($saved['items']->{'supplier.list.domain'}, $searched['items'][0]->{'supplier.list.domain'});
     $this->assertEquals($saved['items']->{'supplier.list.refid'}, $searched['items'][0]->{'supplier.list.refid'});
     $this->assertEquals($saved['items']->{'supplier.list.datestart'}, $searched['items'][0]->{'supplier.list.datestart'});
     $this->assertEquals($saved['items']->{'supplier.list.dateend'}, $searched['items'][0]->{'supplier.list.dateend'});
     $this->assertEquals($saved['items']->{'supplier.list.config'}, $searched['items'][0]->{'supplier.list.config'});
     $this->assertEquals($saved['items']->{'supplier.list.position'}, $searched['items'][0]->{'supplier.list.position'});
     $this->assertEquals($saved['items']->{'supplier.list.status'}, $searched['items'][0]->{'supplier.list.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Пример #9
0
 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');
 }
Пример #10
0
 public function testSaveDeleteItem()
 {
     $params = (object) array('site' => 'unittest', 'limit' => 1);
     $productManager = new \Aimeos\Controller\ExtJS\Product\Standard(\TestHelper::getContext());
     $result = $productManager->searchItems($params);
     $params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.lists.type.domain' => 'text')))), 'start' => 0, 'limit' => 1);
     $productListTypeManager = \Aimeos\Controller\ExtJS\Product\Lists\Type\Factory::createController(\TestHelper::getContext());
     $resultType = $productListTypeManager->searchItems($params);
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('product.lists.parentid' => $result['items'][0]->{'product.id'}, 'product.lists.typeid' => $resultType['items'][0]->{'product.lists.type.id'}, 'product.lists.domain' => 'text', 'product.lists.refid' => -1, 'product.lists.datestart' => '2000-01-01 00:00:00', 'product.lists.dateend' => '2001-01-01 00:00:00', 'product.lists.config' => array('test' => 'unit'), 'product.lists.position' => 1, 'product.lists.status' => 1));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.lists.refid' => -1)))));
     $saved = $this->object->saveItems($saveParams);
     $searched = $this->object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'product.lists.id'});
     $this->object->deleteItems($deleteParams);
     $result = $this->object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'product.lists.id'});
     $this->assertEquals($saved['items']->{'product.lists.id'}, $searched['items'][0]->{'product.lists.id'});
     $this->assertEquals($saved['items']->{'product.lists.parentid'}, $searched['items'][0]->{'product.lists.parentid'});
     $this->assertEquals($saved['items']->{'product.lists.typeid'}, $searched['items'][0]->{'product.lists.typeid'});
     $this->assertEquals($saved['items']->{'product.lists.domain'}, $searched['items'][0]->{'product.lists.domain'});
     $this->assertEquals($saved['items']->{'product.lists.refid'}, $searched['items'][0]->{'product.lists.refid'});
     $this->assertEquals($saved['items']->{'product.lists.datestart'}, $searched['items'][0]->{'product.lists.datestart'});
     $this->assertEquals($saved['items']->{'product.lists.dateend'}, $searched['items'][0]->{'product.lists.dateend'});
     $this->assertEquals($saved['items']->{'product.lists.config'}, $searched['items'][0]->{'product.lists.config'});
     $this->assertEquals($saved['items']->{'product.lists.position'}, $searched['items'][0]->{'product.lists.position'});
     $this->assertEquals($saved['items']->{'product.lists.status'}, $searched['items'][0]->{'product.lists.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Пример #11
0
 public function testSaveUpdateDeleteItem()
 {
     // insert case
     $item = $this->_object->createItem();
     $item->setLabel('new name');
     $item->setStatus(1);
     $item->setCode('XXX');
     $this->_object->saveItem($item);
     $itemSaved = $this->_object->getItem($item->getId());
     // update case
     $itemExp = clone $itemSaved;
     $itemExp->setLabel('new new name');
     $this->_object->saveItem($itemExp);
     $itemUpd = $this->_object->getItem($itemExp->getId());
     $this->_object->deleteItem($item->getId());
     $context = TestHelper::getContext();
     $this->assertTrue($item->getId() !== null);
     $this->assertEquals($item->getId(), $itemSaved->getId());
     $this->assertEquals($item->getLabel(), $itemSaved->getLabel());
     $this->assertEquals($item->getStatus(), $itemSaved->getStatus());
     $this->assertEquals($item->getCode(), $itemSaved->getCode());
     $this->assertEquals($context->getEditor(), $itemSaved->getEditor());
     $this->assertRegExp('/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/', $itemSaved->getTimeCreated());
     $this->assertRegExp('/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/', $itemSaved->getTimeModified());
     $this->assertEquals($itemExp->getId(), $itemUpd->getId());
     $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus());
     $this->assertEquals($itemExp->getCode(), $itemUpd->getCode());
     $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel());
     $this->assertEquals($context->getEditor(), $itemUpd->getEditor());
     $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
     $this->assertRegExp('/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/', $itemUpd->getTimeModified());
     $this->setExpectedException('MShop_Exception');
     $this->_object->getItem($item->getId());
 }
Пример #12
0
 /**
  * Sets up the fixture. This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->editor = \TestHelper::getContext()->getEditor();
     $this->context = \TestHelper::getContext();
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context);
     $this->object = $orderManager->getSubManager('base')->getSubManager('address');
 }
Пример #13
0
 public function testSaveDeleteItem()
 {
     $serviceManager = MShop_Service_Manager_Factory::createManager(TestHelper::getContext());
     $search = $serviceManager->createSearch();
     $search->setConditions($search->compare('==', 'service.label', 'unitlabel'));
     $resultService = $serviceManager->searchItems($search);
     if (($item = reset($resultService)) === false) {
         throw new Exception('No service item found');
     }
     $params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('service.list.type.domain' => 'product')))), 'start' => 0, 'limit' => 1);
     $serviceListTypeManager = Controller_ExtJS_Service_List_Type_Factory::createController(TestHelper::getContext());
     $resultType = $serviceListTypeManager->searchItems($params);
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('service.list.parentid' => $item->getId(), 'service.list.typeid' => $resultType['items'][0]->{'service.list.type.id'}, 'service.list.domain' => 'product', 'service.list.refid' => -1, 'service.list.datestart' => '2000-01-01 00:00:00', 'service.list.dateend' => '2001-01-01 00:00:00', 'service.list.config' => array('test' => 'unit'), 'service.list.position' => 1, 'service.list.status' => 1));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('service.list.refid' => -1)))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'service.list.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'service.list.id'});
     $this->assertEquals($saved['items']->{'service.list.id'}, $searched['items'][0]->{'service.list.id'});
     $this->assertEquals($saved['items']->{'service.list.parentid'}, $searched['items'][0]->{'service.list.parentid'});
     $this->assertEquals($saved['items']->{'service.list.typeid'}, $searched['items'][0]->{'service.list.typeid'});
     $this->assertEquals($saved['items']->{'service.list.domain'}, $searched['items'][0]->{'service.list.domain'});
     $this->assertEquals($saved['items']->{'service.list.refid'}, $searched['items'][0]->{'service.list.refid'});
     $this->assertEquals($saved['items']->{'service.list.datestart'}, $searched['items'][0]->{'service.list.datestart'});
     $this->assertEquals($saved['items']->{'service.list.dateend'}, $searched['items'][0]->{'service.list.dateend'});
     $this->assertEquals($saved['items']->{'service.list.config'}, $searched['items'][0]->{'service.list.config'});
     $this->assertEquals($saved['items']->{'service.list.position'}, $searched['items'][0]->{'service.list.position'});
     $this->assertEquals($saved['items']->{'service.list.status'}, $searched['items'][0]->{'service.list.status'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
 public function itDeletesTheRepository()
 {
     $event = TestHelper::getPartialMock('SystemEvent_GIT_REPO_DELETE', array('getRepositoryFactory'));
     $event->setParameters($this->project_id . SystemEvent::PARAMETER_SEPARATOR . $this->repository_id);
     stub($event)->getRepositoryFactory()->returns($this->git_repository_factory);
     $event->process();
 }
Пример #15
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();
     $paths = TestHelper::getHtmlTemplatePaths();
     $this->_object = new Client_Html_Catalog_Stage_Navigator_Default($context, $paths);
     $this->_object->setView(TestHelper::getView());
 }
Пример #16
0
 /**
  * Sets up the fixture. This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->_editor = TestHelper::getContext()->getEditor();
     $this->_context = TestHelper::getContext();
     $orderManager = MShop_Order_Manager_Factory::createManager($this->_context);
     $this->_object = $orderManager->getSubManager('base')->getSubManager('address');
 }
Пример #17
0
 public function testCreateManagerInvalidName()
 {
     $this->setExpectedException('MShop_Product_Exception');
     $target = 'MShop_Common_Manager_Interface';
     $manager = MShop_Product_Manager_Factory::createManager(TestHelper::getContext(), '#$%');
     $this->assertInstanceOf($target, $manager);
 }
Пример #18
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $this->setExpectedException('Controller_Jobs_Exception');
     Controller_Jobs_Order_Cleanup_Unfinished_Factory::createController($context, $arcavias, 'Factory');
 }
Пример #19
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 = \TestHelper::getContext();
     $paths = \TestHelper::getHtmlTemplatePaths();
     $this->object = new \Aimeos\Client\Html\Basket\Related\Standard($this->context, $paths);
     $this->object->setView(\TestHelper::getView());
 }
Пример #20
0
 public function testTransform()
 {
     $catalogManager = MShop_Catalog_Manager_Factory::createManager(TestHelper::getContext());
     $node = $catalogManager->getTree(null, array(), MW_Tree_Manager_Abstract::LEVEL_ONE);
     $output = $this->_object->transform($node, array());
     $this->assertContains('Root', $output);
 }
Пример #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 = TestHelper::getContext();
     $paths = TestHelper::getHtmlTemplatePaths();
     $this->_object = new Client_Html_Catalog_List_Items_Default($context, $paths);
     $catalogManager = MShop_Catalog_Manager_Factory::createManager($context);
     $search = $catalogManager->createSearch();
     $search->setConditions($search->compare('==', 'catalog.code', 'cafe'));
     $catItems = $catalogManager->searchItems($search);
     if (($catItem = reset($catItems)) === false) {
         throw new Exception('No catalog item found');
     }
     $productManager = MShop_Product_Manager_Factory::createManager($context);
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
     $total = 0;
     $view = TestHelper::getView();
     $view->listProductItems = $productManager->searchItems($search, array('media', 'price', 'text'), $total);
     $view->listProductTotal = $total;
     $view->listPageSize = 100;
     $view->listPageCurr = 1;
     $view->listParams = array();
     $view->listCatPath = array($catalogManager->createItem(), $catItem);
     $this->_object->setView($view);
 }
Пример #22
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = \TestHelper::getContext();
     $aimeos = \TestHelper::getAimeos();
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     $object = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController($context, $aimeos, 'Factory');
 }
Пример #23
0
 public function testSaveDeleteItem()
 {
     $manager = MShop_Service_Manager_Factory::createManager(TestHelper::getContext());
     $typeManager = $manager->getSubManager('type');
     $search = $typeManager->createSearch();
     $search->setConditions($search->compare('==', 'service.type.code', 'delivery'));
     $result = $typeManager->searchItems($search);
     if (($type = reset($result)) === false) {
         throw new Exception('No service type found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('service.position' => 1, 'service.label' => 'test service', 'service.status' => 1, 'service.code' => 'testcode', 'service.provider' => 'Default', 'service.config' => array('default.url' => 'www.url.de', 'default.project' => 'test'), 'service.typeid' => $type->getId()));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('service.code' => 'testcode')))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'service.id'});
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'service.id'});
     $this->assertEquals($saved['items']->{'service.id'}, $searched['items'][0]->{'service.id'});
     $this->assertEquals($saved['items']->{'service.position'}, $searched['items'][0]->{'service.position'});
     $this->assertEquals($saved['items']->{'service.label'}, $searched['items'][0]->{'service.label'});
     $this->assertEquals($saved['items']->{'service.status'}, $searched['items'][0]->{'service.status'});
     $this->assertEquals($saved['items']->{'service.code'}, $searched['items'][0]->{'service.code'});
     $this->assertEquals($saved['items']->{'service.provider'}, $searched['items'][0]->{'service.provider'});
     $this->assertEquals($saved['items']->{'service.config'}, $searched['items'][0]->{'service.config'});
     $this->assertEquals($saved['items']->{'service.typeid'}, $searched['items'][0]->{'service.typeid'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
Пример #24
0
 public function testGetBodyNoCatId()
 {
     $this->object->setView(\TestHelper::getView());
     $output = $this->object->getBody();
     $this->assertRegExp('#Your search result#smU', $output);
     $this->assertStringStartsWith('<div class="catalog-stage-breadcrumb">', $output);
 }
Пример #25
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->editor = \TestHelper::getContext()->getEditor();
     $manager = \Aimeos\MShop\Supplier\Manager\Factory::createManager(\TestHelper::getContext());
     $listManager = $manager->getSubManager('lists');
     $this->object = $listManager->getSubManager('type');
 }
Пример #26
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $this->setExpectedException('Controller_Jobs_Exception');
     Controller_Jobs_Catalog_Index_Rebuild_Factory::createController($context, $arcavias, 'Factory');
 }
Пример #27
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 = TestHelper::getContext();
     $paths = TestHelper::getHtmlTemplatePaths();
     $this->_object = new Client_Html_Basket_Mini_Default($this->_context, $paths);
     $this->_object->setView(TestHelper::getView());
 }
Пример #28
0
 public function testProcess()
 {
     $type = MShop_Order_Item_Base_Address_Abstract::TYPE_DELIVERY;
     $manager = MShop_Customer_Manager_Factory::createManager($this->_context);
     $addrManager = $manager->getSubManager('address');
     $search = $manager->createSearch();
     $search->setSlice(0, 1);
     $result = $manager->searchItems($search);
     if (($customerItem = reset($result)) === false) {
         throw new Exception('No customer item found');
     }
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setId(null);
     $basketCntl = Controller_Frontend_Basket_Factory::createController($this->_context);
     $basketCntl->setAddress($type, $addrItem);
     $view = TestHelper::getView();
     $view->orderBasket = $basketCntl->get();
     $view->orderBasket->setCustomerId($customerItem->getId());
     $this->_object->setView($view);
     $this->_object->process();
     $orderAddress = $view->orderBasket->getAddress($type);
     $actual = $addrManager->getItem($orderAddress->getAddressId());
     $addrManager->deleteItem($actual->getId());
     $this->assertEquals($addrItem->getFirstname(), $actual->getFirstname());
     $this->assertEquals($addrItem->getLastname(), $actual->getLastname());
     $this->assertEquals($addrItem->getPostal(), $actual->getPostal());
     $this->assertEquals($addrItem->getTelephone(), $actual->getTelephone());
     $this->assertEquals($addrItem->getTelefax(), $actual->getTelefax());
 }
Пример #29
0
 public function testFactoryExceptionWrongInterface()
 {
     $context = \TestHelper::getContext();
     $aimeos = \TestHelper::getAimeos();
     $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
     \Aimeos\Controller\Jobs\Index\Optimize\Factory::createController($context, $aimeos, 'Factory');
 }
Пример #30
0
 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->_context = TestHelper::getContext();
     $this->_editor = $this->_context->getEditor();
     $manager = MShop_Price_Manager_Factory::createManager($this->_context, 'Default');
     $this->_object = $manager->getSubManager('list', 'Default');
 }