/
Obj.test.php
45 lines (35 loc) · 1.04 KB
/
Obj.test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* PHP.Gt (http://php.gt)
* @copyright Copyright Ⓒ 2015 Bright Flair Ltd. (http://brightflair.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
*/
namespace Gt\Core;
class Obj_Test extends \PHPUnit_Framework_TestCase {
public function testObjPropertyDoesNotExist() {
$obj = new Obj();
$this->assertObjectNotHasAttribute("attributeName", $obj);
}
public function testObjPropertyIsCreated() {
$obj = new Obj([], true);
$obj->test = "testValue";
$this->assertEquals("testValue", $obj->test);
}
public function testObjNestedPropertyIsCreated() {
$obj = new Obj([], true);
$obj->test->nested = "nestedValue";
$this->assertObjectHasAttribute("test", $obj);
$this->assertEquals("nestedValue", $obj->test->nested);
}
public function testObjConstructs() {
$obj = new Obj([
"testProperty" => "testValue",
]);
$this->assertEquals("testValue", $obj->testProperty);
}
public function testObjCallable() {
$obj = new Obj([], false, true);
$value = $obj->callMe();
$this->assertInstanceOf("\Gt\Core\Obj", $value);
}
}#