• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP expects函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中expects函数的典型用法代码示例。如果您正苦于以下问题:PHP expects函数的具体用法?PHP expects怎么用?PHP expects使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: testGetShippingDataObject

 /**
  * @param array $addressData
  * @param bool $useBaseCurrency
  * @param string $shippingTaxClass
  * @param bool shippingPriceInclTax
  * @param array $expectedValue
  * @dataProvider getShippingDataObjectDataProvider
  */
 public function testGetShippingDataObject(array $addressData, $useBaseCurrency, $shippingTaxClass, $shippingPriceInclTax)
 {
     $baseShippingAmount = $addressData['base_shipping_amount'];
     $shippingAmount = $addressData['shipping_amount'];
     $itemMock = $this->getMock('Magento\\Tax\\Api\\Data\\QuoteDetailsItemInterface');
     $this->taxConfig->expects($this->any())->method('getShippingTaxClass')->with($this->store)->will($this->returnValue($shippingTaxClass));
     $this->taxConfig->expects($this->any())->method('shippingPriceIncludesTax')->with($this->store)->will($this->returnValue($shippingPriceInclTax));
     $this->address->expects($this->atLeastOnce())->method('getShippingDiscountAmount')->willReturn($shippingAmount);
     if ($shippingAmount) {
         if ($useBaseCurrency && $shippingAmount != 0) {
             $this->address->expects($this->once())->method('getBaseShippingDiscountAmount')->willReturn($baseShippingAmount);
             $this->quoteDetailsItemBuilderMock->expects($this->once())->method('setDiscountAmount')->with($baseShippingAmount);
         } else {
             $this->address->expects($this->never())->method('getBaseShippingDiscountAmount');
             $this->quoteDetailsItemBuilderMock->expects($this->once())->method('setDiscountAmount')->with($shippingAmount);
         }
     }
     foreach ($addressData as $key => $value) {
         $this->address->setData($key, $value);
     }
     $this->taxClassKeyBuilderMock->expects($this->any())->method('setType')->willReturnSelf();
     $this->taxClassKeyBuilderMock->expects($this->any())->method('setValue')->with($shippingTaxClass)->willReturnSelf();
     $this->quoteDetailsItemBuilderMock->expects($this->once())->method('create')->willReturn($itemMock);
     $this->assertEquals($itemMock, $this->commonTaxCollector->getShippingDataObject($this->address, $useBaseCurrency));
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:33,代码来源:CommonTaxCollectorTest.php


示例2: testParse

 public function testParse()
 {
     $expectedResult = [['phrase' => 'phrase1', 'file' => 'file1', 'line' => 15, 'quote' => '']];
     $this->_phraseCollectorMock->expects($this->once())->method('parse')->with('file1');
     $this->_phraseCollectorMock->expects($this->once())->method('getPhrases')->will($this->returnValue([['phrase' => 'phrase1', 'file' => 'file1', 'line' => 15]]));
     $this->_adapter->parse('file1');
     $this->assertEquals($expectedResult, $this->_adapter->getPhrases());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:8,代码来源:PhpTest.php


示例3: testExecute

 /**
  * @param array $options
  * @param ItemStub $actualContext
  * @param ItemStub $expectedContext
  * @param array $expectedData
  * @dataProvider optionsDataProvider
  */
 public function testExecute(array $options, ItemStub $actualContext, ItemStub $expectedContext, array $expectedData = array())
 {
     $expectedWorkflowName = $expectedContext->workflowName;
     $expectedEntity = !empty($options['entity']) ? $expectedContext->entityValue : null;
     $expectedTransition = !empty($options['transition']) ? $expectedContext->startTransition : null;
     $expectedWorkflowItem = $expectedContext->workflowItem;
     $this->workflowManager->expects($this->once())->method('startWorkflow')->with($expectedWorkflowName, $expectedEntity, $expectedTransition, $expectedData)->will($this->returnValue($expectedWorkflowItem));
     $this->action->initialize($options);
     $this->action->execute($actualContext);
     $this->assertEquals($expectedContext->getData(), $actualContext->getData());
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:18,代码来源:StartWorkflowTest.php


示例4: setUp

 /**
  * Set up
  */
 protected function setUp()
 {
     $this->resultPage = $this->getMock('Magento\\Backend\\Model\\View\\Result\\Page', ['setActiveMenu', 'getConfig', 'getTitle', 'prepend', 'addBreadcrumb'], [], '', false);
     $this->resultPage->expects($this->any())->method('getConfig')->willReturnSelf();
     $this->resultPage->expects($this->any())->method('getTitle')->willReturnSelf();
     $this->resultFactory = $this->getMock('Magento\\Framework\\Controller\\ResultFactory', ['create'], [], '', false);
     $this->resultFactory->expects($this->any())->method('create')->willReturn($this->resultPage);
     $this->context = $this->getMock('Magento\\Backend\\App\\Action\\Context', ['getResultFactory'], [], '', false);
     $this->context->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactory);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->indexController = $this->objectManagerHelper->getObject('Magento\\ImportExport\\Controller\\Adminhtml\\History\\Index', ['context' => $this->context]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:IndexTest.php


示例5: should_parse_variable_contains_operators

 public function should_parse_variable_contains_operators()
 {
     expects($this->parse('org'))->should_be(array(':org'));
     expects($this->parse('dand'))->should_be(array(':dand'));
     expects($this->parse('xor'))->should_be(array(':xor'));
     expects($this->parse('notd'))->should_be(array(':notd'));
 }
开发者ID:tonjoo,项目名称:tiga-framework,代码行数:7,代码来源:parser_spec.php


示例6: testAuthorize

 /**
  * Test method
  * with resultCode = RESPONSE_CODE_APPROVED and Origresult != RESPONSE_CODE_FRAUDSERVICE_FILTER
  */
 public function testAuthorize()
 {
     $this->initializationAuthorizeMock();
     $this->buildRequestData();
     $paymentTokenMock = $this->getMock(PaymentTokenInterface::class);
     $extensionAttributes = $this->getMockBuilder('Magento\\Sales\\Api\\Data\\OrderPaymentExtensionInterface')->disableOriginalConstructor()->setMethods(['setVaultPaymentToken'])->getMock();
     $ccDetails = ['cc_type' => 'VI', 'cc_number' => '1111'];
     $this->responseMock->setData('result_code', Payflowpro::RESPONSE_CODE_APPROVED);
     $this->responseMock->setData('origresult', 0);
     $this->responseMock->setData('pnref', 'test-pnref');
     $this->gatewayMock->expects($this->once())->method('postRequest')->willReturn($this->responseMock);
     $this->responseValidator->expects($this->once())->method('validate')->with($this->responseMock);
     $this->paymentMock->expects($this->once())->method('setTransactionId')->with('test-pnref')->willReturnSelf();
     $this->paymentMock->expects($this->once())->method('setIsTransactionClosed')->with(0);
     $this->paymentMock->expects($this->once())->method('getCcExpYear')->willReturn('2017');
     $this->paymentMock->expects($this->once())->method('getCcExpMonth')->willReturn('12');
     $this->paymentMock->expects(static::any())->method('getAdditionalInformation')->willReturnMap([[Transparent::CC_DETAILS, $ccDetails], [Transparent::PNREF, 'test-pnref']]);
     $this->paymentTokenFactory->expects(static::once())->method('create')->willReturn($paymentTokenMock);
     $paymentTokenMock->expects(static::once())->method('setGatewayToken')->with('test-pnref');
     $paymentTokenMock->expects(static::once())->method('setTokenDetails')->with(json_encode($ccDetails));
     $paymentTokenMock->expects(static::once())->method('setExpiresAt')->with('2018-01-01 00:00:00');
     $this->paymentMock->expects(static::once())->method('getExtensionAttributes')->willReturn($extensionAttributes);
     $extensionAttributes->expects(static::once())->method('setVaultPaymentToken')->with($paymentTokenMock);
     $this->assertSame($this->object, $this->object->authorize($this->paymentMock, 33));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:29,代码来源:TransparentTest.php


示例7: should_parse_variable_contains_operators

 function should_parse_variable_contains_operators()
 {
     expects($this->parse("org"))->should_be(array(':org', 'expression_end'));
     expects($this->parse("dand"))->should_be(array(':dand', 'expression_end'));
     expects($this->parse("xor"))->should_be(array(':xor', 'expression_end'));
     expects($this->parse("notd"))->should_be(array(':notd', 'expression_end'));
 }
开发者ID:hgezim,项目名称:h2o-php,代码行数:7,代码来源:parser_spec.php


示例8: testShouldAcceptOnlyREQSockets

 /**
  * @test should accept only REQ sockets
  */
 public function testShouldAcceptOnlyREQSockets()
 {
     $this->socket = $this->getMockBuilder('\\ZMQSocket')->disableOriginalConstructor()->getMock();
     $this->socket->expects($this->any())->method('getSocketType')->will($this->returnValue(\ZMQ::SOCKET_PUSH));
     $this->setExpectedException('\\InvalidArgumentException', 'Invalid socket type');
     new ZeroMQClientTransport($this->socket);
 }
开发者ID:wookieb,项目名称:zorro-rpc,代码行数:10,代码来源:ZeroMQClientTransportTest.php


示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     \Locale::setDefault('en');
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
     $this->requestStack = new RequestStack();
     /* @var Request $request */
     $request = $this->getMock('Symfony\\Component\\HttpFoundation\\Request');
     $this->requestStack->push($request);
     $this->router->expects($this->any())->method('generate')->will($this->returnCallback(function ($param) {
         return '/' . $param;
     }));
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new ChoiceSelect2TypeExtension($this->dispatcher, $this->requestStack, $this->router, $this->getExtensionTypeName(), 10))->getFormFactory();
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
 }
开发者ID:mcdir,项目名称:SonatraFormExtensionsBundle,代码行数:17,代码来源:AbstractSelect2TypeExtensionTest.php


示例10: should_be_able_to_include_in_nested_fashion

 public function should_be_able_to_include_in_nested_fashion()
 {
     $h2o = new H2o('page.html', $this->option);
     $result = $h2o->render();
     expects($result)->should_match('/layout text/');
     expects($result)->should_match('/Page footer/');
     expects($result)->should_match('/page menu/');
 }
开发者ID:tonjoo,项目名称:tiga-framework,代码行数:8,代码来源:include_spec.php


示例11: testExecute

 public function testExecute()
 {
     $context = new StubStorage(array('array' => array('key_1' => 'value_1', 'key_2' => 'value_2'), 'key' => null, 'value' => null, 'new_array' => array()));
     $options = array(Traverse::OPTION_KEY_ARRAY => new PropertyPath('array'), Traverse::OPTION_KEY_KEY => new PropertyPath('key'), Traverse::OPTION_KEY_VALUE => new PropertyPath('value'), Traverse::OPTION_KEY_ACTIONS => array('actions', 'configuration'));
     $this->configurableAction->expects($this->once())->method('initialize')->with($options[Traverse::OPTION_KEY_ACTIONS]);
     $this->configurableAction->expects($this->any())->method('execute')->with($context)->will($this->returnCallback(function (StubStorage $context) {
         $key = $context['key'];
         $value = $context['value'];
         $newArray = $context['new_array'];
         $newArray[$key] = $value;
         $context['new_array'] = $newArray;
     }));
     $this->action->initialize($options);
     $this->action->execute($context);
     $this->assertNull($context['key']);
     $this->assertNull($context['value']);
     $this->assertEquals($context['array'], $context['new_array']);
 }
开发者ID:Maksold,项目名称:platform,代码行数:18,代码来源:TraverseTest.php


示例12: setUp

 public function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->taxConfig = $this->getMockBuilder('\\Magento\\Tax\\Model\\Config')->disableOriginalConstructor()->setMethods(['getShippingTaxClass', 'shippingPriceIncludesTax'])->getMock();
     $this->store = $this->getMockBuilder('\\Magento\\Store\\Model\\Store')->disableOriginalConstructor()->setMethods(['__wakeup'])->getMock();
     $this->quote = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods(['__wakeup', 'getStore'])->getMock();
     $this->quote->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
     $this->address = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote\\Address')->disableOriginalConstructor()->getMock();
     $this->address->expects($this->any())->method('getQuote')->will($this->returnValue($this->quote));
     $methods = ['create'];
     $this->quoteDetailsItemDataObject = $objectManager->getObject('Magento\\Tax\\Model\\Sales\\Quote\\ItemDetails');
     $this->taxClassKeyDataObject = $objectManager->getObject('Magento\\Tax\\Model\\TaxClass\\Key');
     $this->quoteDetailsItemDataObjectFactoryMock = $this->getMock('Magento\\Tax\\Api\\Data\\QuoteDetailsItemInterfaceFactory', $methods, [], '', false);
     $this->quoteDetailsItemDataObjectFactoryMock->expects($this->any())->method('create')->willReturn($this->quoteDetailsItemDataObject);
     $this->taxClassKeyDataObjectFactoryMock = $this->getMock('Magento\\Tax\\Api\\Data\\TaxClassKeyInterfaceFactory', $methods, [], '', false);
     $this->taxClassKeyDataObjectFactoryMock->expects($this->any())->method('create')->willReturn($this->taxClassKeyDataObject);
     $this->commonTaxCollector = $objectManager->getObject('Magento\\Tax\\Model\\Sales\\Total\\Quote\\CommonTaxCollector', ['taxConfig' => $this->taxConfig, 'quoteDetailsItemDataObjectFactory' => $this->quoteDetailsItemDataObjectFactoryMock, 'taxClassKeyDataObjectFactory' => $this->taxClassKeyDataObjectFactoryMock]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:CommonTaxCollectorTest.php


示例13: testAuthorize

 /**
  * Test method
  * with resultCode = RESPONSE_CODE_APPROVED and Origresult != RESPONSE_CODE_FRAUDSERVICE_FILTER
  */
 public function testAuthorize()
 {
     $this->initializationAuthorizeMock();
     $this->buildRequestData();
     $this->responseMock->expects($this->any())->method('getResultCode')->willReturn(Payflowpro::RESPONSE_CODE_APPROVED);
     $this->responseMock->expects($this->any())->method('getOrigresult')->willReturn(0);
     $this->gatewayMock->expects($this->once())->method('postRequest')->willReturn($this->responseMock);
     $this->responseValidator->expects($this->once())->method('validate')->with($this->responseMock);
     $this->responseMock->expects($this->once())->method('getPnref')->willReturn('test-pnref');
     $this->paymentMock->expects($this->once())->method('setTransactionId')->with('test-pnref')->willReturnSelf();
     $this->paymentMock->expects($this->once())->method('setIsTransactionClosed')->with(0);
     $this->assertSame($this->object, $this->object->authorize($this->paymentMock, 33));
 }
开发者ID:nja78,项目名称:magento2,代码行数:17,代码来源:TransparentTest.php


示例14: testGetSearchCriteriaAnd

 public function testGetSearchCriteriaAnd()
 {
     // Test ((A > 1) and (B > 1))
     $fieldA = 'A';
     $fieldB = 'B';
     $value = 1;
     $sortOrder = $this->sortOrderBuilder->setField('name')->setDirection(SortOrder::SORT_ASC)->create();
     /** @var SearchCriteria $expectedSearchCriteria */
     $expectedSearchCriteria = $this->searchCriteriaBuilder->setCurrentPage(1)->setPageSize(0)->addSortOrder($sortOrder)->addFilters([$this->filterBuilder->setField($fieldA)->setConditionType('gt')->setValue($value)->create()])->addFilters([$this->filterBuilder->setField($fieldB)->setConditionType('gt')->setValue($value)->create()])->create();
     // Verifies that the search criteria Data Object created by the serviceCollection matches expected
     $this->groupRepositoryMock->expects($this->once())->method('getList')->with($this->equalTo($expectedSearchCriteria))->will($this->returnValue($this->searchResults));
     // Now call service collection to load the data.  This causes it to create the search criteria Data Object
     $this->serviceCollection->addFieldToFilter($fieldA, ['gt' => $value]);
     $this->serviceCollection->addFieldToFilter($fieldB, ['gt' => $value]);
     $this->serviceCollection->setOrder('name', ServiceCollection::SORT_ORDER_ASC);
     $this->serviceCollection->loadData();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:ServiceCollectionTest.php


示例15: setUp

 /**
  * Set up
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function setUp()
 {
     parent::setUp();
     //connection and sql query results
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto', 'fetchAssoc'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $adapter = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $adapter->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
     $this->select->expects($this->any())->method('getAdapter')->willReturn($adapter);
     $this->connectionMock->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $this->connectionMock->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connectionMock->expects($this->any())->method('delete')->willReturnSelf();
     $this->connectionMock->expects($this->any())->method('quoteInto')->willReturn('');
     //constructor arguments:
     // 1. $attrSetColFac
     $this->attrSetColFacMock = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->attrSetColMock = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->attrSetColMock->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     // 2. $prodAttrColFac
     $this->prodAttrColFacMock = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create'], [], '', false);
     $attrCollection = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection', [], [], '', false);
     $attrCollection->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->prodAttrColFacMock->expects($this->any())->method('create')->will($this->returnValue($attrCollection));
     // 3. $resource
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->connectionMock));
     $this->resourceMock->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     // 4. $params
     $this->entityModelMock = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product', ['addMessageTemplate', 'getEntityTypeId', 'getBehavior', 'getNewSku', 'getNextBunch', 'isRowAllowedToImport', 'getParameters', 'addRowError'], [], '', false);
     $this->entityModelMock->expects($this->any())->method('addMessageTemplate')->will($this->returnSelf());
     $this->entityModelMock->expects($this->any())->method('getEntityTypeId')->will($this->returnValue(5));
     $this->entityModelMock->expects($this->any())->method('getParameters')->will($this->returnValue([]));
     $this->paramsArray = [$this->entityModelMock, 'downloadable'];
     $this->uploaderMock = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Uploader', ['move'], [], '', false);
     // 6. $filesystem
     $this->directoryWriteMock = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\Write', [], [], '', false);
     // 7. $fileHelper
     $this->uploaderHelper = $this->getMock('\\Magento\\DownloadableImportExport\\Helper\\Uploader', ['getUploader'], [], '', false);
     $this->uploaderHelper->expects($this->any())->method('getUploader')->willReturn($this->uploaderMock);
     $this->downloadableHelper = $this->getMock('\\Magento\\DownloadableImportExport\\Helper\\Data', ['prepareDataForSave'], [], '', false);
     $this->downloadableHelper->expects($this->any())->method('prepareDataForSave')->willReturn([]);
 }
开发者ID:IlyaGluschenko,项目名称:protection,代码行数:49,代码来源:DownloadableTest.php


示例16: should_correctly_parse_expressions

 function should_correctly_parse_expressions()
 {
     $pi = 3;
     $result = h2o('{{ (pi+1)/2+10 }}')->render(compact('pi'));
     expects($result)->should_be('12');
     $except = false;
     try {
         $res = h2o('{{ ()pi+1)/2+10 }}')->render(compact('pi'));
     } catch (Exception $e) {
         $except = true;
     }
     expects($except)->should_be(true);
     $except = false;
     try {
         $res = h2o('{{ +1 }}')->render(compact('pi'));
     } catch (Exception $e) {
         $except = true;
     }
     expects($except)->should_be(true);
 }
开发者ID:hgezim,项目名称:h2o-php,代码行数:20,代码来源:nodes_spec.php


示例17: should_provide_variable_loop_in_for_block

 function should_provide_variable_loop_in_for_block()
 {
     $context = array('items' => array(1, 2, 3, 4, 5));
     $rs = h2o('{% for e in items %}{{ loop.counter }}{%endfor%}')->render($context);
     expects($rs)->should_be('12345');
     $rs = h2o('{% for e in items %}{{ loop.counter0 }}{%endfor%}')->render($context);
     expects($rs)->should_be('01234');
     $rs = h2o('{% for e in items %}{{ loop.revcounter }}{%endfor%}')->render($context);
     expects($rs)->should_be('54321');
     $rs = h2o('{% for e in items %}{{ loop.revcounter0 }}{%endfor%}')->render($context);
     expects($rs)->should_be('43210');
     $rs = h2o('{% for e in items %}{% if loop.first %}first{% else %}{{ e }}{% endif %}{%endfor%}')->render($context);
     expects($rs)->should_be('first2345');
     $rs = h2o('{% for e in items %}{% if loop.last %}last{% else %}{{ e }}{% endif %}{%endfor%}')->render($context);
     expects($rs)->should_be('1234last');
     $rs = h2o('{% for e in items %}{% if loop.even%}even{% else %}{{ e }}{% endif %}{%endfor%}')->render($context);
     expects($rs)->should_be('1even3even5');
     $rs = h2o('{% for e in items %}{% if loop.odd%}odd{% else %}{{ e }}{% endif %}{%endfor%}')->render($context);
     expects($rs)->should_be('odd2odd4odd');
 }
开发者ID:hbasria,项目名称:h2o-php,代码行数:20,代码来源:tags_spec.php


示例18: expects

<?php

require_once "lib/init.php";
$report = Report::get();
expects(array("section" => "int?"));
class ReportPDF extends TCPDF
{
    public function _setup()
    {
        $this->setPrintHeader(false);
        $this->setPrintFooter(true);
        $this->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $this->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $this->SetMargins(PDF_MARGIN_LEFT, 0, PDF_MARGIN_RIGHT);
        $this->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $this->setImageScale(1.4);
        $this->setFontSubsetting(true);
        $this->SetFont('helvetica', '', 14, '', true);
    }
    public function Footer()
    {
        global $report;
        // Position at 15 mm from bottom
        $this->SetY(-15);
        $content3 = $report->find_contents(3);
        if ($content3 !== NULL) {
            $client_ref = $content3->data['client_ref'];
        }
        // Page number
        $this->writeHTMLCell(0, 0, '', '', "\n\t\t\t<hr /><br /><table width=100% style='font-size:16pt'><tr><td align=left>REPORT REFERENCE: " . htmlspecialchars($client_ref) . "</td><td width='50%' align='right'><p align=right>PAGE " . $this->getAliasNumPage() . " OF " . $this->getAliasNbPages() . "</p></td></tr></table>\n\t\t", 0, 1, 0, true, '', true);
开发者ID:hzy,项目名称:Report-Generator,代码行数:31,代码来源:render.php


示例19: should_apply_filter_if_available

 function should_apply_filter_if_available()
 {
     $name = 'taylor luk';
     $result = h2o('{{ name|capitalize }}')->render(compact('name'));
     expects($result)->should_be('Taylor Luk');
 }
开发者ID:hhkaos,项目名称:GeoRemindMe_Web,代码行数:6,代码来源:nodes_spec.php


示例20: expects

<?php

if (!isset($_SESSION['pass']) || $_SESSION['pass'] !== $config['login']['pass']) {
    expects(array("user" => "string?", "pass" => "string?"));
    if ($params["user"] !== NULL || $params["pass"] !== NULL) {
        if ($params["user"] === $config["login"]["user"] && $params["pass"] === $config["login"]["pass"]) {
            $_SESSION["pass"] = $config["login"]["pass"];
            redirect($_SERVER['REQUEST_URI']);
        } else {
            view("login", array("error" => true), false);
        }
    } else {
        view("login", array(), false);
    }
}
开发者ID:hzy,项目名称:Report-Generator,代码行数:15,代码来源:auth.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP expires_header函数代码示例发布时间:2022-05-15
下一篇:
PHP expected_account_preferences函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap