Пример #1
0
 public function testTo()
 {
     $Nest = new Nest();
     // Valid
     $Nest->data($this->data);
     $this->assertEquals($this->data, $Nest->data());
 }
Пример #2
0
 public function testUnset()
 {
     $Nest = new Nest();
     $Nest->data($this->data);
     // First level
     unset($Nest->foo);
     $this->assertEquals(false, $Nest->exists("foo"));
     // Nested
     unset($Nest->one__two);
     $this->assertEquals(false, $Nest->exists(["one", "two"]));
     // Make sure it only deleted the final level
     $this->assertEquals(true, $Nest->exists("one"));
     $Nest = new Nest();
     $Nest->data($this->data);
     // Invalid, nested
     unset($Nest->BAD__two);
     $this->assertEquals(false, $Nest->exists(["BAD", "two"]));
     // Invalid, nested
     unset($Nest->one__BAD);
     $this->assertEquals(false, $Nest->exists(["one", "BAD"]));
     // Make sure it only deleted the final level
     $this->assertEquals(true, $Nest->exists("one"));
     // Invalid, first level
     unset($Nest->BAD);
     $this->assertEquals(false, $Nest->exists("BAD"));
 }
Пример #3
0
 public function testSerialize()
 {
     $Nest = new Nest();
     // Valid
     $Nest->data($this->data);
     // First level
     $tmp = unserialize(serialize($Nest))->data();
     // Nested
     $this->assertEquals($this->data, $tmp);
 }
Пример #4
0
 public function testIsset()
 {
     $Nest = new Nest();
     // Valid
     $Nest->data($this->data);
     // First level
     $this->assertEquals(true, isset($Nest->foo));
     // Nested
     $this->assertEquals(true, isset($Nest->one__two));
     // Invalid, first level
     $this->assertEquals(false, isset($Nest->BAD));
     // Invalid, nested
     $this->assertEquals(false, isset($Nest->one__BAD));
     // Invalid, nested
     $this->assertEquals(false, isset($Nest->BAD__TWO));
 }