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


PHP PHPUnit_Framework_MockObject_MockObject::isValid方法代码示例

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


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

示例1: testValidator

 public function testValidator()
 {
     $this->testInstance->expects($this->any())->method('getValidationObject')->will($this->returnValue($this->testValidator));
     $this->testValidator->expects($this->any())->method('getValidator')->will($this->returnValue($value = uniqid()));
     $this->testValidator->expects($this->any())->method('passes')->will($this->returnValue($valuePasses = uniqid()));
     $this->assertSame($this->testValidator, $this->testInstance->extractValidator());
     $this->assertSame($value, $this->testInstance->getValidator());
     $this->assertSame($valuePasses, $this->testInstance->isValid());
 }
开发者ID:laravel-commode,项目名称:viewmodel,代码行数:9,代码来源:ViewModelTest.php

示例2: testGetValidationClassAddsSuccessClassToGivenClassIfThereAreNoMessages

 /**
  * @covers DmCommon\Form\BaseForm
  */
 public function testGetValidationClassAddsSuccessClassToGivenClassIfThereAreNoMessages()
 {
     $givenClass = 'foo';
     $elementMock = $this->getMock('Zend\\Form\\Element', ['getMessages']);
     $elementMock->expects($this->once())->method('getMessages')->will($this->returnValue([]));
     if (!$this->sut->isValid()) {
         $this->fail(print_r($this->sut->getMessages(), true));
     }
     $actualResult = $this->sut->getValidationClass($elementMock, $givenClass);
     $this->assertEquals($givenClass . ' has-success', $actualResult);
 }
开发者ID:peteraba,项目名称:dm-common,代码行数:14,代码来源:BaseFormTest.php

示例3: testIsValidReturnAddMessagesCall

 public function testIsValidReturnAddMessagesCall()
 {
     $value = [AdvancedPricing::COL_TIER_PRICE_WEBSITE => 'tier value'];
     $allWebsitesValue = 'not tier|group price website value';
     $colTierPriceWebsite = false;
     $expectedMessages = [AdvancedPricing\Validator\Website::ERROR_INVALID_WEBSITE];
     $this->website->expects($this->once())->method('_clearMessages');
     $this->website->expects($this->any())->method('getAllWebsitesValue')->willReturn($allWebsitesValue);
     $this->storeResolver->method('getWebsiteCodeToId')->willReturnMap([[$value[AdvancedPricing::COL_TIER_PRICE_WEBSITE], $colTierPriceWebsite]]);
     $this->website->expects($this->any())->method('_addMessages')->with($expectedMessages);
     $this->website->isValid($value);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:WebsiteTest.php

示例4: testIsValidAddMessagesCall

 /**
  * @dataProvider isValidAddMessagesCallDataProvider
  *
  * @param array $value
  * @param bool  $hasEmptyColumns
  * @param array $customerGroups
  * @param array $expectedMessages
  */
 public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages)
 {
     $this->groupPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true);
     $this->groupPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns);
     $this->setPropertyValue($this->groupPrice, 'customerGroups', $customerGroups);
     $this->groupPrice->expects($this->once())->method('_addMessages')->with($expectedMessages);
     $this->groupPrice->isValid($value);
 }
开发者ID:nja78,项目名称:magento2,代码行数:16,代码来源:GroupPriceTest.php

示例5: testIsValidAddMessagesCall

 /**
  * @dataProvider isValidAddMessagesCallDataProvider
  *
  * @param array $value
  * @param bool  $hasEmptyColumns
  * @param array $customerGroups
  * @param array $expectedMessages
  */
 public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages)
 {
     $priceContextMock = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product', [], ['\\Magento\\Framework\\Json\\Helper\\Data', '\\Magento\\ImportExport\\Helper\\Data', '\\Magento\\ImportExport\\Model\\ResourceModel\\Import\\Data', '\\Magento\\Eav\\Model\\Config', '\\Magento\\Framework\\App\\ResourceConnection', '\\Magento\\ImportExport\\Model\\ResourceModel\\Helper', '\\Magento\\Framework\\Stdlib\\StringUtils', 'ProcessingErrorAggregatorInterface'], '', false);
     $this->tierPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true);
     $this->tierPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns);
     $this->setPropertyValue($this->tierPrice, 'customerGroups', $customerGroups);
     $searchCriteria = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria);
     $groupSearchResult = $this->getMockForAbstractClass('\\Magento\\Customer\\Api\\Data\\GroupSearchResultsInterface', [], '', false);
     $this->groupRepository->expects($this->any())->method('getList')->with($searchCriteria)->willReturn($groupSearchResult);
     $groupTest = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\GroupInterface')->disableOriginalConstructor()->setMethods(['getCode', 'getId'])->getMockForAbstractClass();
     $groupTest->expects($this->once())->method('getCode');
     $groupTest->expects($this->any())->method('getId');
     $groups = [$groupTest];
     $groupSearchResult->expects($this->any())->method('getItems')->willReturn($groups);
     $this->tierPrice->init($priceContextMock);
     $this->tierPrice->isValid($value);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:26,代码来源:TierPriceTest.php


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