【发布时间】:2017-04-09 03:05:06
【问题描述】:
我在 BrandBehavior 中有这个方法,我想测试一下。
public function setCurrentBrandId(Entity $entity)
{
if (!isset($entity->brand_id) or empty($entity->brand_id)) {
$entity->brand_id = $this->session->read("Brand.id");
}
}
我想测试这个方法是否真的设置了 BrandID。你能给我举个例子我应该如何测试这个?到目前为止,我基本上没有介绍任何内容。
public function setUp()
{
parent::setUp();
$this->Progress = new BrandsBehavior();
}
public function testSetCurrentBrandId()
{
}
如果您需要任何其他信息,请告诉我,以便您知道我是测试和测试的初学者。
【问题讨论】:
标签: php cakephp phpunit integration-testing