本文整理汇总了PHP中TestHelper类的典型用法代码示例。如果您正苦于以下问题:PHP TestHelper类的具体用法?PHP TestHelper怎么用?PHP TestHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']));
}
示例2: 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');
}
示例3: 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']));
}
示例4: 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']));
}
示例5: 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');
}
示例6: setUp
/**
* 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']);
}
示例7: testSaveDeleteItem
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']));
}
示例8: 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');
}
示例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']));
}
示例10: 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());
}
示例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');
}
示例12: 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']));
}
示例13: itDeletesTheRepository
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();
}
示例14: 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());
}
示例15: 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 = MShop_Order_Manager_Factory::createManager($this->_context);
$this->_object = $orderManager->getSubManager('base')->getSubManager('address');
}