本文整理汇总了PHP中TestHelperHtml类的典型用法代码示例。如果您正苦于以下问题:PHP TestHelperHtml类的具体用法?PHP TestHelperHtml怎么用?PHP TestHelperHtml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestHelperHtml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 = \TestHelperHtml::getContext();
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Checkout\Standard\Summary\Option\Terms\Standard($this->context, $paths);
$this->object->setView(\TestHelperHtml::getView());
}
示例2: 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 = clone \TestHelperHtml::getContext();
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Account\History\Lists\Standard($this->context, $paths);
$this->object->setView(\TestHelperHtml::getView());
}
示例3: 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 = \TestHelperHtml::getContext();
$this->client = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Catalog\\Filter\\Standard')->setMethods(array('getHeader', 'getBody', 'testMethod'))->setConstructorArgs(array($context, array()))->getMock();
$this->object = new \Aimeos\Client\Html\Common\Decorator\Example($this->client, $context, array());
$this->object->setView(\TestHelperHtml::getView());
}
示例4: testProcess
public function testProcess()
{
$type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY;
$manager = \Aimeos\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 \RuntimeException('No customer item found');
}
$addrItem = $customerItem->getPaymentAddress();
$addrItem->setId(null);
$basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$basketCntl->setAddress($type, $addrItem);
$view = \TestHelperHtml::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());
}
示例5: setUp
protected function setUp()
{
$this->context = \TestHelperHtml::getContext();
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Basket\Related\Bought\Standard($this->context, $paths);
$this->object->setView(\TestHelperHtml::getView());
}
示例6: testGetBodyException
public function testGetBodyException()
{
$mock = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Basket\\Standard\\Standard')->setConstructorArgs(array($this->context, \TestHelperHtml::getHtmlTemplatePaths()))->setMethods(array('setViewParams'))->getMock();
$mock->setView(\TestHelperHtml::getView());
$mock->expects($this->once())->method('setViewParams')->will($this->throwException(new \Exception()));
$mock->getBody();
}
示例7: testGetBodyException
public function testGetBodyException()
{
$object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Checkout\\Confirm\\Standard')->setConstructorArgs(array($this->context, array()))->setMethods(array('setViewParams'))->getMock();
$object->expects($this->once())->method('setViewParams')->will($this->throwException(new \RuntimeException()));
$object->setView(\TestHelperHtml::getView());
$this->assertContains('A non-recoverable error occured', $object->getBody());
}
示例8: testGetBodyNoCatId
public function testGetBodyNoCatId()
{
$this->object->setView(\TestHelperHtml::getView());
$output = $this->object->getBody();
$this->assertRegExp('#Your search result#smU', $output);
$this->assertStringStartsWith('<div class="catalog-stage-breadcrumb">', $output);
}
示例9: testGetBodyException
public function testGetBodyException()
{
$object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Catalog\\Count\\Standard')->setConstructorArgs(array($this->context, array()))->setMethods(array('setViewParams'))->getMock();
$object->expects($this->once())->method('setViewParams')->will($this->throwException(new \RuntimeException()));
$object->setView(\TestHelperHtml::getView());
$this->assertEquals(null, $object->getBody());
}
示例10: testGetBodyMShopException
public function testGetBodyMShopException()
{
$object = $this->getMockBuilder('\\Aimeos\\Client\\Html\\Account\\Watch\\Standard')->setConstructorArgs(array($this->context, array()))->setMethods(array('setViewParams'))->getMock();
$object->expects($this->once())->method('setViewParams')->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
$object->setView(\TestHelperHtml::getView());
$this->assertContains('test exception', $object->getBody());
}
示例11: testProcessOK
public function testProcessOK()
{
$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$baseManager = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context)->getSubManager('base');
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$search = $serviceManager->createSearch();
$search->setConditions($search->compare('==', 'service.code', 'unitpaymentcode'));
$result = $serviceManager->searchItems($search);
if (($serviceItem = reset($result)) === false) {
throw new \RuntimeException('No service item found');
}
$controller->setService('payment', $serviceItem->getId());
$controller->setAddress('payment', array('order.base.address.languageid' => 'en'));
$this->context->setUserId('-1');
$view = \TestHelperHtml::getView();
$param = array('cs_order' => 1);
$helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param);
$view->addHelper('param', $helper);
$this->object->setView($view);
$this->object->process();
$search = $baseManager->createSearch();
$search->setConditions($search->compare('==', 'order.base.customerid', '-1'));
$result = $baseManager->searchItems($search);
if (($item = reset($result)) === false) {
throw new \RuntimeException('No order placed');
}
$baseManager->deleteItem($item->getId());
$this->assertInstanceOf('\\Aimeos\\MShop\\Order\\Item\\Iface', $view->orderItem);
$this->assertEquals($item->getId(), $view->orderItem->getBaseId());
}
示例12: testProcess
public function testProcess()
{
$type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT;
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
$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->setEmail('unittest@aimeos.org');
$mailStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\None')->disableOriginalConstructor()->getMock();
$mailMsgStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\Message\\None')->disableOriginalConstructor()->disableOriginalClone()->getMock();
$mailStub->expects($this->once())->method('createMessage')->will($this->returnValue($mailMsgStub));
$mailStub->expects($this->once())->method('send');
$this->context->setMail($mailStub);
$basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$basketCntl->setAddress($type, $addrItem);
$view = \TestHelperHtml::getView();
$view->orderBasket = $basketCntl->get();
$this->context->setView($view);
$this->object->setView($view);
$orderBaseStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
$customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
$orderBaseStub->expects($this->once())->method('saveItem');
$customerStub->expects($this->once())->method('saveItem');
\Aimeos\MShop\Factory::injectManager($this->context, 'customer', $customerStub);
\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $orderBaseStub);
$this->object->process();
}
示例13: setUp
protected function setUp()
{
$this->context = clone \TestHelperHtml::getContext();
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Checkout\Confirm\Order\Standard($this->context, $paths);
$this->object->setView(\TestHelperHtml::getView());
}
示例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()
{
$this->context = \TestHelperHtml::getContext();
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Catalog\Session\Pinned\Standard($this->context, $paths);
$this->object->setView(\TestHelperHtml::getView());
}
示例15: 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 = \TestHelperHtml::getContext();
$config = $context->getConfig();
$config->set('client/html/catalog/lists/basket-add', true);
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Catalog\Lists\Items\Standard($context, $paths);
$catalogManager = \Aimeos\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 \RuntimeException('No catalog item found');
}
$domains = array('media', 'price', 'text', 'attribute', 'product');
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$search = $productManager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNE', 'U:TEST', 'U:BUNDLE')));
$total = 0;
$view = \TestHelperHtml::getView('unittest', $config);
$view->listProductItems = $productManager->searchItems($search, $domains, $total);
$view->listProductTotal = $total;
$view->listPageSize = 100;
$view->listPageCurr = 1;
$view->listParams = array();
$view->listCatPath = array($catalogManager->createItem(), $catItem);
$this->object->setView($view);
}