yiiapi/tests/framework/collections/CAttributeCollectionTest.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

Yii::import('system.collections.CAttributeCollection');

class CAttributeCollectionTest extends CTestCase
{
	public function testCanGetProperty()
	{
		$collection = new CAttributeCollection();
		$collection->Property = 'value';
		$this->assertEquals('value', $collection->Property);
		$this->assertTrue($collection->canGetProperty('Property'));
	}

	public function testCanNotGetUndefinedProperty()
	{
		$collection = new CAttributeCollection(array(), true);
		$this->assertFalse($collection->canGetProperty('Property'));
		$this->setExpectedException('CException');
		$value=$collection->Property;
	}

	public function testCanSetProperty()
	{
		$collection = new CAttributeCollection();
		$collection->Property = 'value';
		$this->assertEquals('value', $collection->itemAt('Property'));
		$this->assertTrue($collection->canSetProperty('Property'));
	}

	public function testCanNotSetPropertyIfReadOnly()
	{
		$collection = new CAttributeCollection(array(), true);
		$this->setExpectedException('CException');
		$collection->Property = 'value';
	}

	public function testGetCaseSensitive()
	{
		$collection = new CAttributeCollection();
		$collection->caseSensitive=false;
		$this->assertFalse($collection->caseSensitive);
		$collection->caseSensitive=true;
		$this->assertTrue($collection->caseSensitive);
	}

	public function testSetCaseSensitive()
	{
		$collection = new CAttributeCollection();
		$collection->Property = 'value';
		$collection->caseSensitive=false;
		$this->assertEquals('value', $collection->itemAt('property'));
	}

	public function testItemAt()
	{
		$collection = new CAttributeCollection();
		$collection->Property = 'value';
		$this->assertEquals('value', $collection->itemAt('Property'));
	}
后面还有 66 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。