Browse Source

more tests for Object

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
411a1b84d5
  1. 21
      tests/unit/framework/base/ObjectTest.php

21
tests/unit/framework/base/ObjectTest.php

@ -71,6 +71,12 @@ class ObjectTest extends TestCase
$this->object->NewMember = $value;
}
public function testSetReadOnlyProperty()
{
$this->setExpectedException('yii\base\InvalidCallException');
$this->object->object = 'test';
}
public function testIsset()
{
$this->assertTrue(isset($this->object->Text));
@ -83,6 +89,9 @@ class ObjectTest extends TestCase
$this->object->Text = null;
$this->assertFalse(isset($this->object->Text));
$this->assertTrue(empty($this->object->Text));
$this->assertFalse(isset($this->object->unknownProperty));
$this->assertTrue(empty($this->object->unknownProperty));
}
public function testUnset()
@ -92,6 +101,18 @@ class ObjectTest extends TestCase
$this->assertTrue(empty($this->object->Text));
}
public function testUnsetReadOnlyProperty()
{
$this->setExpectedException('yii\base\InvalidCallException');
unset($this->object->object);
}
public function testCallUnknownMethod()
{
$this->setExpectedException('yii\base\UnknownMethodException');
$this->object->unknownMethod();
}
public function testArrayProperty()
{
$this->assertEquals(array(), $this->object->items);

Loading…
Cancel
Save