当前位置: 首页>>代码示例>>PHP>>正文


PHP TestHelper::getContext方法代码示例

本文整理汇总了PHP中TestHelper::getContext方法的典型用法代码示例。如果您正苦于以下问题:PHP TestHelper::getContext方法的具体用法?PHP TestHelper::getContext怎么用?PHP TestHelper::getContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestHelper的用法示例。


在下文中一共展示了TestHelper::getContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSaveDeleteItem

 public function testSaveDeleteItem()
 {
     $couponManager = MShop_Coupon_Manager_Factory::createManager(TestHelper::getContext());
     $search = $couponManager->createSearch();
     $search->setConditions($search->compare('==', 'coupon.label', 'Unit test example'));
     $result = $couponManager->searchItems($search);
     if (($couponItem = reset($result)) === false) {
         throw new Exception('No coupon item found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('coupon.code.couponid' => $couponItem->getId(), 'coupon.code.code' => 'zzzz', 'coupon.code.count' => -1));
     $searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('coupon.code.code' => 'zzzz')))));
     $saved = $this->_object->saveItems($saveParams);
     $searched = $this->_object->searchItems($searchParams);
     $deleteParams = (object) array('site' => 'unittest', 'items' => array($saved['items']->{'coupon.code.id'}));
     $this->_object->deleteItems($deleteParams);
     $result = $this->_object->searchItems($searchParams);
     $this->assertInternalType('object', $saved['items']);
     $this->assertNotNull($saved['items']->{'coupon.code.id'});
     $this->assertEquals($saved['items']->{'coupon.code.couponid'}, $searched['items'][0]->{'coupon.code.couponid'});
     $this->assertEquals($saved['items']->{'coupon.code.code'}, $searched['items'][0]->{'coupon.code.code'});
     $this->assertEquals($saved['items']->{'coupon.code.count'}, $searched['items'][0]->{'coupon.code.count'});
     $this->assertEquals($saved['items']->{'coupon.code.datestart'}, $searched['items'][0]->{'coupon.code.datestart'});
     $this->assertEquals($saved['items']->{'coupon.code.dateend'}, $searched['items'][0]->{'coupon.code.dateend'});
     $this->assertEquals(1, count($searched['items']));
     $this->assertEquals(0, count($result['items']));
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:26,代码来源:DefaultTest.php

示例2: testSaveDeleteItem

 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']));
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:30,代码来源:DefaultTest.php

示例3: setUp

 /**
  * 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');
 }
开发者ID:nos3,项目名称:ai-symfony2,代码行数:13,代码来源:FosUserTest.php

示例4: setUp

 /**
  * 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');
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:13,代码来源:StandardTest.php

示例5: testSaveDeleteItem

 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']));
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:27,代码来源:DefaultTest.php

示例6: setUp

 /**
  * 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_Checkout_Standard_Summary_Service_Default($this->_context, $paths);
     $this->_object->setView(TestHelper::getView());
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:13,代码来源:DefaultTest.php

示例7: setUp

 /**
  * 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\Checkout\Standard\Payment\Standard($this->context, $paths);
     $this->object->setView(\TestHelper::getView());
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:13,代码来源:StandardTest.php

示例8: testSaveUpdateDeleteItem

 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());
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:34,代码来源:DefaultTest.php

示例9: testSaveDeleteItem

 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']));
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:30,代码来源:StandardTest.php

示例10: testSaveDeleteItem

 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']));
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:34,代码来源:DefaultTest.php

示例11: setUp

 /**
  * 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');
 }
开发者ID:andreasfernandez,项目名称:aimeos-core,代码行数:10,代码来源:StandardTest.php

示例12: setUp

 /**
  * 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());
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:13,代码来源:DefaultTest.php

示例13: testSaveDeleteItem

 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']));
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:29,代码来源:StandardTest.php

示例14: testCreateManagerInvalidName

 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);
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:7,代码来源:FactoryTest.php

示例15: testFactoryExceptionWrongInterface

 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');
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:7,代码来源:FactoryTest.php


注:本文中的TestHelper::getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。