本文整理汇总了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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}