本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::setId方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::setId怎么用?PHP PHPUnit_Framework_MockObject_MockObject::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::setId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAttributeById
public function testGetAttributeById()
{
$this->productResource->expects($this->any())->method('loadAllAttributes')->will($this->returnValue($this->productResource));
$this->productResource->expects($this->any())->method('getSortedAttributes')->will($this->returnValue([$this->attribute]));
$this->attribute->setId(1);
$this->assertEquals($this->attribute, $this->model->getAttributeById(1, $this->product));
$this->assertNull($this->model->getAttributeById(0, $this->product));
}
示例2: testHasChildThemes
/**
* @test
* @return void
*/
public function testHasChildThemes()
{
$this->_model->setId(1);
$this->resourceCollection->expects($this->once())->method('addTypeFilter')->with(Theme::TYPE_VIRTUAL)->willReturnSelf();
$this->resourceCollection->expects($this->once())->method('addFieldToFilter')->with('parent_id', ['eq' => 1])->willReturnSelf();
$this->resourceCollection->expects($this->once())->method('getSize')->willReturn(10);
$this->assertTrue($this->_model->hasChildThemes());
}
示例3: testIsCanDelete
public function testIsCanDelete()
{
$this->assertFalse($this->model->isCanDelete());
$this->model->load(1);
$this->assertFalse($this->model->isCanDelete());
$this->model->setId(100);
$this->assertFalse($this->model->isCanDelete());
}
示例4: testSetOrder
public function testSetOrder()
{
$orderId = 1111;
$storeId = 2221;
$this->orderMock->setId($orderId);
$this->orderMock->setStoreId($storeId);
$this->assertNull($this->model->getOrderId());
$this->assertNull($this->model->getStoreId());
$this->assertEquals($this->model, $this->model->setOrder($this->orderMock));
$this->assertEquals($this->orderMock, $this->model->getOrder());
$this->assertEquals($orderId, $this->model->getOrderId());
$this->assertEquals($storeId, $this->model->getStoreId());
}
示例5: deleteModelSuccessfully
/**
* Callback for delete method in mocked model
*/
public function deleteModelSuccessfully()
{
$this->_model->setId(null);
}
示例6: testProcessTemplate
public function testProcessTemplate()
{
$this->mockModel();
$this->model->setId('customer_create_account_email_template');
$this->assertContains('<body', $this->model->processTemplate());
}
示例7: testGetCustomViewConfigPath
/**
* @covers \Magento\Framework\View\Design\Theme\Customization\Path::getCustomViewConfigPath
*/
public function testGetCustomViewConfigPath()
{
$expectedPath = implode('/', [\Magento\Framework\View\Design\Theme\Customization\Path::DIR_NAME, '123', \Magento\Framework\View\ConfigInterface::CONFIG_FILE_NAME]);
$this->assertEquals($expectedPath, $this->_model->getCustomViewConfigPath($this->_theme->setId(123)));
$this->assertNull($this->_model->getCustomViewConfigPath($this->_theme->setId(null)));
}
示例8: testSetId
/**
* @param \PHPUnit_Framework_MockObject_MockObject $criteria
* @return \PHPUnit_Framework_MockObject_MockObject
*
* @depends testImplementCriteriaInterface
* @covers Sellsy\Criteria\Generic\GetOneCriteria::setId
*/
public function testSetId(\PHPUnit_Framework_MockObject_MockObject $criteria)
{
$criteria->setId(12);
$this->assertEquals(12, $criteria->getId());
return $criteria;
}