Example #1
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"));
 }
Example #2
0
 public function testExists()
 {
     $Nest = new Nest();
     // Valid
     $Nest->data($this->data);
     // First level
     $this->assertEquals(true, $Nest->exists("foo"));
     // Nested
     $this->assertEquals(true, $Nest->exists(["one", "two"]));
     // Invalid, first level
     $this->assertEquals(false, $Nest->exists("BAD"));
     // Invalid, nested
     $this->assertEquals(false, $Nest->exists(["one", "BAD"]));
     // Invalid, nested
     $this->assertEquals(false, $Nest->exists(["BAD", "two"]));
 }