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


PHP SearchCriteriaBuilder::expects方法代码示例

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


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

示例1: testGetAllOptions

 /**
  * Run test getAllOptions method
  *
  * @param bool $isEmpty
  * @param array $expected
  * @dataProvider dataProviderGetAllOptions
  */
 public function testGetAllOptions($isEmpty, array $expected)
 {
     $filterMock = $this->getMock('Magento\\Framework\\Api\\Filter', [], [], '', false);
     $searchCriteriaMock = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $searchResultsMock = $this->getMockForAbstractClass('Magento\\Tax\\Api\\Data\\TaxClassSearchResultsInterface', [], '', false, true, true, ['getItems']);
     $taxClassMock = $this->getMockForAbstractClass('Magento\\Tax\\Api\\Data\\TaxClassInterface', ['getClassId', 'getClassName'], '', false, true, true);
     $this->filterBuilderMock->expects($this->once())->method('setField')->with(\Magento\Tax\Model\ClassModel::KEY_TYPE)->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('setValue')->with(\Magento\Tax\Api\TaxClassManagementInterface::TYPE_CUSTOMER)->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock);
     $this->searchCriteriaBuilderMock->expects($this->once())->method('addFilter')->with([$filterMock])->willReturnSelf();
     $this->searchCriteriaBuilderMock->expects($this->once())->method('create')->willReturn($searchCriteriaMock);
     $this->taxClassRepositoryMock->expects($this->once())->method('getList')->with($searchCriteriaMock)->willReturn($searchResultsMock);
     if (!$isEmpty) {
         $taxClassMock->expects($this->once())->method('getClassId')->willReturn(10);
         $taxClassMock->expects($this->once())->method('getClassName')->willReturn('class-name');
         $items = [$taxClassMock];
         $searchResultsMock->expects($this->once())->method('getItems')->willReturn($items);
         // checking of a lack of re-initialization
         for ($i = 10; --$i;) {
             $result = $this->customer->getAllOptions();
             $this->assertEquals($expected, $result);
         }
     } else {
         $items = [];
         $searchResultsMock->expects($this->once())->method('getItems')->willReturn($items);
         // checking exception
         $this->assertEmpty($this->customer->getAllOptions());
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:36,代码来源:CustomerTest.php

示例2: testGetByIdentifierNamespace

 public function testGetByIdentifierNamespace()
 {
     $userId = 1;
     $namespace = 'some_namespace';
     $identifier = 'current';
     $this->userContext->expects($this->once())->method('getUserId')->willReturn($userId);
     $fieldUserId = new Filter([Filter::KEY_FIELD => 'user_id', Filter::KEY_VALUE => $userId, Filter::KEY_CONDITION_TYPE => 'eq']);
     $fieldIdentifier = new Filter([Filter::KEY_FIELD => 'identifier', Filter::KEY_VALUE => $identifier, Filter::KEY_CONDITION_TYPE => 'eq']);
     $fieldNamespace = new Filter([Filter::KEY_FIELD => 'namespace', Filter::KEY_VALUE => $namespace, Filter::KEY_CONDITION_TYPE => 'eq']);
     $bookmarkId = 1;
     $bookmark = $this->getMockBuilder('Magento\\Ui\\Api\\Data\\BookmarkInterface')->getMockForAbstractClass();
     $bookmark->expects($this->once())->method('getId')->willReturn($bookmarkId);
     $searchCriteria = $this->getMockBuilder('Magento\\Framework\\Api\\SearchCriteriaInterface')->getMockForAbstractClass();
     $this->filterBuilder->expects($this->at(0))->method('create')->willReturn($fieldUserId);
     $this->filterBuilder->expects($this->at(1))->method('create')->willReturn($fieldIdentifier);
     $this->filterBuilder->expects($this->at(2))->method('create')->willReturn($fieldNamespace);
     $this->searchCriteriaBuilder->expects($this->once())->method('addFilters')->with([$fieldUserId, $fieldIdentifier, $fieldNamespace]);
     $this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
     $searchResult = $this->getMockBuilder('Magento\\Ui\\Api\\Data\\BookmarkSearchResultsInterface')->getMockForAbstractClass();
     $searchResult->expects($this->once())->method('getTotalCount')->willReturn(1);
     $searchResult->expects($this->once())->method('getItems')->willReturn([$bookmark]);
     $this->bookmarkRepository->expects($this->once())->method('getList')->with($searchCriteria)->willReturn($searchResult);
     $this->bookmarkRepository->expects($this->once())->method('getById')->with($bookmarkId)->willReturn($bookmark);
     $this->assertEquals($bookmark, $this->bookmarkManagement->getByIdentifierNamespace($identifier, $namespace));
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:25,代码来源:BookmarkManagementTest.php

示例3: testResolve

 public function testResolve()
 {
     $documentIds = [1, 2, 3];
     $attributeSetIds = [4, 5];
     $requestName = 'request_name';
     $this->attributeSetFinder->expects($this->once())->method('findAttributeSetIdsByProductIds')->with($documentIds)->willReturn($attributeSetIds);
     $searchCriteria = $this->getMock(SearchCriteriaInterface::class);
     $this->searchCriteriaBuilder->expects($this->once())->method('addFilter')->with('attribute_set_id', $attributeSetIds, 'in')->willReturnSelf();
     $this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
     $attributeFirst = $this->getMock(ProductAttributeInterface::class);
     $attributeFirst->expects($this->once())->method('getAttributeCode')->willReturn('code_1');
     $attributeSecond = $this->getMock(ProductAttributeInterface::class);
     $attributeSecond->expects($this->once())->method('getAttributeCode')->willReturn('code_2');
     $searchResult = $this->getMock(ProductAttributeSearchResultsInterface::class);
     $searchResult->expects($this->once())->method('getItems')->willReturn([$attributeFirst, $attributeSecond]);
     $this->productAttributeRepository->expects($this->once())->method('getList')->with($searchCriteria)->willReturn($searchResult);
     $bucketFirst = $this->getMock(BucketInterface::class);
     $bucketFirst->expects($this->once())->method('getField')->willReturn('code_1');
     $bucketSecond = $this->getMock(BucketInterface::class);
     $bucketSecond->expects($this->once())->method('getField')->willReturn('some_another_code');
     $bucketThird = $this->getMock(BucketInterface::class);
     $bucketThird->expects($this->once())->method('getName')->willReturn('custom_not_attribute_field');
     $this->request->expects($this->once())->method('getAggregation')->willReturn([$bucketFirst, $bucketSecond, $bucketThird]);
     $this->request->expects($this->once())->method('getName')->willReturn($requestName);
     $this->config->expects($this->once())->method('get')->with($requestName)->willReturn(['aggregations' => ['custom_not_attribute_field' => []]]);
     $this->assertEquals([$bucketFirst, $bucketThird], $this->aggregationResolver->resolve($this->request, $documentIds));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:27,代码来源:AggregationResolverTest.php

示例4: setUp

 protected function setUp()
 {
     $this->groupRepositoryInterface = $this->getMock('Magento\\Customer\\Model\\ResourceModel\\GroupRepository', [], [], '', false);
     $this->searchCriteriaSearch = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $this->searchCriteriaBuilder = $this->getMock('Magento\\Framework\\Api\\SearchCriteriaBuilder', [], [], '', false);
     $this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($this->searchCriteriaSearch);
     $this->storeResolver = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product\\StoreResolver', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->tierPrice = $this->objectManagerHelper->getObject('Magento\\CatalogImportExport\\Model\\Import\\Product\\Validator\\TierPrice', ['groupRepository' => $this->groupRepositoryInterface, 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, 'storeResolver' => $this->storeResolver]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:TierPriceTest.php

示例5: testGetFeeds

 public function testGetFeeds()
 {
     $feeds = ['feed1', 'feed2'];
     $searchCriteria = $this->getMockBuilder('\\Magento\\Framework\\Api\\SearchCriteria')->disableOriginalConstructor()->getMock();
     $this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
     $searchResult = $this->getMockBuilder('\\Magento\\SampleServiceContractNew\\API\\Data\\FeedSearchResultInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $searchResult->expects($this->once())->method('getItems')->willReturn($feeds);
     $this->feedRepository->expects($this->once())->method('getList')->willReturn($searchResult);
     $this->assertEquals($feeds, $this->block->getFeeds());
 }
开发者ID:imbrj,项目名称:magento2-samples,代码行数:10,代码来源:FeedListTest.php

示例6: testToOptionArray

 public function testToOptionArray()
 {
     $customerGroups = [['label' => __('ALL GROUPS'), 'value' => 32000], ['label' => __('NOT LOGGED IN'), 'value' => 0]];
     $this->moduleManagerMock->expects($this->any())->method('isEnabled')->willReturn(true);
     $this->searchCriteriaBuilderMock->expects($this->any())->method('create')->willReturn($this->searchCriteriaMock);
     $this->groupRepositoryMock->expects($this->any())->method('getList')->with($this->searchCriteriaMock)->willReturn($this->searchResultMock);
     $this->groupRepositoryMock->expects($this->any())->method('getList')->with($this->searchCriteriaMock)->willReturn($this->searchResultMock);
     $groupTest = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\GroupInterface')->disableOriginalConstructor()->setMethods(['getCode', 'getId'])->getMockForAbstractClass();
     $groupTest->expects($this->any())->method('getCode')->willReturn(__('NOT LOGGED IN'));
     $groupTest->expects($this->any())->method('getId')->willReturn(0);
     $groups = [$groupTest];
     $this->searchResultMock->expects($this->any())->method('getItems')->willReturn($groups);
     $this->assertEquals($customerGroups, $this->model->toOptionArray());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:GroupTest.php

示例7: setUp

 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder(ContextInterface::class)->getMockForAbstractClass();
     $this->attributeRepositoryMock = $this->getMockBuilder(ProductAttributeRepositoryInterface::class)->getMockForAbstractClass();
     $this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)->disableOriginalConstructor()->getMock();
     $this->uiElementProcessorMock = $this->getMockBuilder(UiElementProcessor::class)->disableOriginalConstructor()->getMock();
     $this->searchCriteriaMock = $this->getMockBuilder(SearchCriteria::class)->disableOriginalConstructor()->getMock();
     $this->searchResultsMock = $this->getMockBuilder(ProductAttributeSearchResultsInterface::class)->getMockForAbstractClass();
     $this->contextMock->expects(static::any())->method('getProcessor')->willReturn($this->uiElementProcessorMock);
     $this->searchCriteriaBuilderMock->expects(static::any())->method('addFilter')->willReturnSelf();
     $this->searchCriteriaBuilderMock->expects(static::any())->method('create')->willReturn($this->searchCriteriaMock);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->attributesColumn = $this->objectManagerHelper->getObject(AttributesColumn::class, ['context' => $this->contextMock, 'attributeRepository' => $this->attributeRepositoryMock, 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:AttributesTest.php

示例8: testGetConfig

 public function testGetConfig()
 {
     $customerId = 1;
     $visible = true;
     $storeId = 1;
     $vaultProviderCode = "vault_provider_code";
     $expectedConfig = ['payment' => [VaultPaymentInterface::CODE => [VaultPaymentInterface::CODE . '_item_' . '0' => ['config' => ['token_code' => 'code'], 'component' => 'Vendor_Module/js/vault_component']]]];
     $searchCriteriaMock = $this->getMockBuilder(SearchCriteria::class)->disableOriginalConstructor()->getMock();
     $searchResultMock = $this->getMockBuilder(PaymentTokenSearchResultsInterface::class)->getMockForAbstractClass();
     $tokenMock = $this->getMockBuilder(PaymentTokenInterface::class)->getMockForAbstractClass();
     $tokenUiComponentProvider = $this->getMock(TokenUiComponentProviderInterface::class);
     $tokenUiComponent = $this->getMock(TokenUiComponentInterface::class);
     $this->storeManager->expects(static::once())->method('getStore')->with(null)->willReturn($this->store);
     $this->store->expects(static::once())->method('getId')->willReturn($storeId);
     $this->vaultPayment->expects(static::once())->method('isActive')->with($storeId)->willReturn(true);
     $this->customerSessionMock->expects(self::once())->method('getCustomerId')->willReturn($customerId);
     $customerFilterMock = $this->createExpectedFilter(PaymentTokenInterface::CUSTOMER_ID, $customerId, 0);
     $visibilityFilterMock = $this->createExpectedFilter(PaymentTokenInterface::IS_VISIBLE, $visible, 1);
     $this->vaultPayment->expects(static::once())->method('getProviderCode')->willReturn($vaultProviderCode);
     $codeFilterMock = $this->createExpectedFilter(PaymentTokenInterface::PAYMENT_METHOD_CODE, $vaultProviderCode, 2);
     $this->searchCriteriaBuilderMock->expects(self::once())->method('addFilters')->with([$customerFilterMock, $visibilityFilterMock, $codeFilterMock])->willReturnSelf();
     $this->searchCriteriaBuilderMock->expects(self::once())->method('create')->willReturn($searchCriteriaMock);
     $this->paymentTokenRepositoryMock->expects(self::once())->method('getList')->with($searchCriteriaMock)->willReturn($searchResultMock);
     $searchResultMock->expects(self::once())->method('getItems')->willReturn([$tokenMock]);
     $tokenUiComponentProvider->expects(static::once())->method('getComponentForToken')->with($tokenMock)->willReturn($tokenUiComponent);
     $tokenUiComponent->expects(static::once())->method('getConfig')->willReturn(['token_code' => 'code']);
     $tokenUiComponent->expects(static::once())->method('getName')->willReturn('Vendor_Module/js/vault_component');
     $configProvider = new TokensConfigProvider($this->customerSessionMock, $this->paymentTokenRepositoryMock, $this->filterBuilderMock, $this->searchCriteriaBuilderMock, $this->storeManager, $this->vaultPayment, [$vaultProviderCode => $tokenUiComponentProvider]);
     static::assertEquals($expectedConfig, $configProvider->getConfig());
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:30,代码来源:TokensConfigProviderTest.php

示例9: testInitAddToCustomerGroups

 public function testInitAddToCustomerGroups()
 {
     $searchCriteria = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
     $groupSearchResult = $this->getMockForAbstractClass('\\Magento\\Customer\\Api\\Data\\GroupSearchResultsInterface', [], '', false);
     $this->groupRepository->expects($this->once())->method('getList')->with($searchCriteria)->willReturn($groupSearchResult);
     $groupTest = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\GroupInterface')->disableOriginalConstructor()->setMethods(['getCode', 'getId'])->getMockForAbstractClass();
     $expectedCode = 'code';
     $expectedId = 'id';
     $expectedCustomerGroups = [$expectedCode => $expectedId];
     $groupTest->expects($this->once())->method('getCode')->willReturn($expectedCode);
     $groupTest->expects($this->once())->method('getId')->willReturn($expectedId);
     $groups = [$groupTest];
     $groupSearchResult->expects($this->once())->method('getItems')->willReturn($groups);
     $this->groupPrice->init();
     $this->assertEquals($expectedCustomerGroups, $this->getPropertyValue($this->groupPrice, 'customerGroups'));
 }
开发者ID:nja78,项目名称:magento2,代码行数:17,代码来源:GroupPriceTest.php

示例10: getSearchCriteria

 /**
  * Build search criteria
  * @param int $customerId
  * @param string $vaultProviderCode
  * @return \PHPUnit_Framework_MockObject_MockObject
  */
 private function getSearchCriteria($customerId, $vaultProviderCode)
 {
     $searchCriteria = $this->getMockBuilder(SearchCriteria::class)->disableOriginalConstructor()->getMock();
     $customerFilter = $this->createExpectedFilter(PaymentTokenInterface::CUSTOMER_ID, $customerId, 0);
     $codeFilter = $this->createExpectedFilter(PaymentTokenInterface::PAYMENT_METHOD_CODE, $vaultProviderCode, 1);
     $this->searchCriteriaBuilder->expects(self::once())->method('addFilters')->with([$customerFilter, $codeFilter])->willReturnSelf();
     $this->searchCriteriaBuilder->expects(self::once())->method('create')->willReturn($searchCriteria);
     return $searchCriteria;
 }
开发者ID:uibar,项目名称:lavinia2,代码行数:15,代码来源:TokensConfigProviderTest.php

示例11: buildSearchCriteria

 /**
  * Build search criteria
  */
 private function buildSearchCriteria()
 {
     $this->filterBuilder->expects(static::exactly(2))->method('setField')->willReturnSelf();
     $this->filterBuilder->expects(static::exactly(2))->method('setValue')->willReturnSelf();
     $searchCriteria = new SearchCriteria();
     $this->searchCriteriaBuilder->expects(static::once())->method('addFilters')->willReturnSelf();
     $this->searchCriteriaBuilder->expects(static::once())->method('create')->willReturn($searchCriteria);
     $this->transactionRepository->expects(static::once())->method('getList')->with($searchCriteria)->willReturnSelf();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:CaptureStrategyCommandTest.php

示例12: testGetAllOptionsNameIntegrity

 /**
  * Run test getAllOptions method for names integrity
  *
  * @param array $value
  * @dataProvider dataProviderGetAllOptionsNameIntegrity
  */
 public function testGetAllOptionsNameIntegrity(array $value)
 {
     $filterMock = $this->getMock('Magento\\Framework\\Api\\Filter', [], [], '', false);
     $searchCriteriaMock = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $searchResultsMock = $this->getMockForAbstractClass('Magento\\Tax\\Api\\Data\\TaxClassSearchResultsInterface', [], '', false, true, true, ['getItems']);
     $taxClassMock = $this->getMockForAbstractClass('Magento\\Tax\\Api\\Data\\TaxClassInterface', ['getClassId', 'getClassName'], '', false, true, true);
     $this->filterBuilderMock->expects($this->once())->method('setField')->with(\Magento\Tax\Model\ClassModel::KEY_TYPE)->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('setValue')->with(\Magento\Tax\Api\TaxClassManagementInterface::TYPE_PRODUCT)->willReturnSelf();
     $this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock);
     $this->searchCriteriaBuilderMock->expects($this->once())->method('addFilters')->with([$filterMock])->willReturnSelf();
     $this->searchCriteriaBuilderMock->expects($this->once())->method('create')->willReturn($searchCriteriaMock);
     $this->taxClassRepositoryMock->expects($this->once())->method('getList')->with($searchCriteriaMock)->willReturn($searchResultsMock);
     $taxClassMock->expects($this->once())->method('getClassId')->willReturn($value['value']);
     $taxClassMock->expects($this->once())->method('getClassName')->willReturn($value['label']);
     $items = [$taxClassMock];
     $searchResultsMock->expects($this->once())->method('getItems')->willReturn($items);
     $result = $this->product->getAllOptions(false);
     $expected = $value;
     $this->assertEquals([$expected], $result);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:26,代码来源:ProductTest.php

示例13: getSearchCriteria

 /**
  * Build search criteria
  * @param int $customerId
  * @param string $vaultProviderCode
  * @return \PHPUnit_Framework_MockObject_MockObject
  */
 private function getSearchCriteria($customerId, $vaultProviderCode)
 {
     $searchCriteria = $this->getMockBuilder(SearchCriteria::class)->disableOriginalConstructor()->getMock();
     $customerFilter = $this->createExpectedFilter(PaymentTokenInterface::CUSTOMER_ID, $customerId, 0);
     $codeFilter = $this->createExpectedFilter(PaymentTokenInterface::PAYMENT_METHOD_CODE, $vaultProviderCode, 1);
     $isActiveFilter = $this->createExpectedFilter(PaymentTokenInterface::IS_ACTIVE, 1, 2);
     // express at expectations
     $expiresAtFilter = $this->createExpectedFilter(PaymentTokenInterface::EXPIRES_AT, '2015-01-01 00:00:00', 3);
     $this->filterBuilder->expects(static::once())->method('setConditionType')->with('gt')->willReturnSelf();
     $this->searchCriteriaBuilder->expects(self::once())->method('addFilters')->with([$customerFilter, $codeFilter, $expiresAtFilter, $isActiveFilter])->willReturnSelf();
     $this->searchCriteriaBuilder->expects(self::once())->method('create')->willReturn($searchCriteria);
     return $searchCriteria;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:19,代码来源:TokensConfigProviderTest.php

示例14: testGetProductsWithFilter

 public function testGetProductsWithFilter()
 {
     $products = ['Product1', 'Product2'];
     $searchCriteria = $this->getMockBuilder('Magento\\Framework\\Api\\SearchCriteriaInterface')->getMockForAbstractClass();
     $this->request->expects($this->exactly(2))->method('getParam')->with($this->equalTo('type'))->willReturn('FilterProductType');
     $this->filterBuilder->expects($this->once())->method('setField')->with('type_id')->willReturnSelf();
     $this->filterBuilder->expects($this->once())->method('setValue')->with($this->equalTo('FilterProductType'))->willReturnSelf();
     $filter = $this->getMockBuilder('Magento\\Framework\\Api\\Filter')->getMock();
     $this->filterBuilder->expects($this->once())->method('create')->willReturn($filter);
     $this->searchCriteriaBuilder->expects($this->once())->method('addFilter')->with($this->equalTo([$filter]))->willReturnSelf();
     $this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
     $this->productRepository->expects($this->once())->method('getList')->with($searchCriteria)->willReturn($products);
     $result = $this->block->getProducts();
     $this->assertEquals($products, $result);
 }
开发者ID:luo3555,项目名称:magento2-samples,代码行数:15,代码来源:ProductListTest.php

示例15: testCaptureExecute

 /**
  * @param int $size
  * @param string $command
  * @covers       \Magento\BraintreeTwo\Gateway\Command\CaptureStrategyCommand::execute
  * @dataProvider captureDataProvider
  */
 public function testCaptureExecute($size, $command)
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $subject['payment'] = $paymentData;
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->payment->expects(static::once())->method('getAuthorizationTransaction')->willReturn(true);
     $this->payment->expects(static::once())->method('getId')->willReturn(1);
     $this->filterBuilder->expects(static::exactly(2))->method('setField')->willReturnSelf();
     $this->filterBuilder->expects(static::exactly(2))->method('setValue')->willReturnSelf();
     $searchCriteria = new SearchCriteria();
     $this->searchCriteriaBuilder->expects(static::once())->method('addFilters')->willReturnSelf();
     $this->searchCriteriaBuilder->expects(static::once())->method('create')->willReturn($searchCriteria);
     $this->transactionRepository->expects(static::once())->method('getList')->with($searchCriteria)->willReturnSelf();
     $this->transactionRepository->expects(static::once())->method('getTotalCount')->willReturn($size);
     $this->commandPool->expects(static::once())->method('get')->with($command)->willReturn($this->command);
     $this->strategyCommand->execute($subject);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:23,代码来源:CaptureStrategyCommandTest.php


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