Commit 411a1b84 by Alexander Makarov

more tests for Object

parent 4c7bd953
...@@ -71,6 +71,12 @@ class ObjectTest extends TestCase ...@@ -71,6 +71,12 @@ class ObjectTest extends TestCase
$this->object->NewMember = $value; $this->object->NewMember = $value;
} }
public function testSetReadOnlyProperty()
{
$this->setExpectedException('yii\base\InvalidCallException');
$this->object->object = 'test';
}
public function testIsset() public function testIsset()
{ {
$this->assertTrue(isset($this->object->Text)); $this->assertTrue(isset($this->object->Text));
...@@ -83,6 +89,9 @@ class ObjectTest extends TestCase ...@@ -83,6 +89,9 @@ class ObjectTest extends TestCase
$this->object->Text = null; $this->object->Text = null;
$this->assertFalse(isset($this->object->Text)); $this->assertFalse(isset($this->object->Text));
$this->assertTrue(empty($this->object->Text)); $this->assertTrue(empty($this->object->Text));
$this->assertFalse(isset($this->object->unknownProperty));
$this->assertTrue(empty($this->object->unknownProperty));
} }
public function testUnset() public function testUnset()
...@@ -92,6 +101,18 @@ class ObjectTest extends TestCase ...@@ -92,6 +101,18 @@ class ObjectTest extends TestCase
$this->assertTrue(empty($this->object->Text)); $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() public function testArrayProperty()
{ {
$this->assertEquals(array(), $this->object->items); $this->assertEquals(array(), $this->object->items);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment