exists()); self::assertFalse($a->available()); self::assertSame($default, $a->get($default)); $i = false; $a = new ValueAccess($i); self::assertTrue($a->exists()); self::assertTrue($a->available()); self::assertSame(false, $a->get($default)); $i = ""; $a = new ValueAccess($i); self::assertTrue($a->exists()); self::assertTrue($a->available()); self::assertSame("", $a->get($default)); # $i = null; $a = new ValueAccess($i, ["allow_null" => false]); self::assertFalse($a->exists()); self::assertFalse($a->available()); self::assertSame($default, $a->get($default)); $i = null; $a = new ValueAccess($i, ["allow_null" => true]); self::assertTrue($a->exists()); self::assertTrue($a->available()); self::assertSame(null, $a->get($default)); # $i = false; $a = new ValueAccess($i, ["allow_false" => false]); self::assertTrue($a->exists()); self::assertFalse($a->available()); self::assertSame($default, $a->get($default)); $i = false; $a = new ValueAccess($i, ["allow_false" => true]); self::assertTrue($a->exists()); self::assertTrue($a->available()); self::assertSame(false, $a->get($default)); # $i = ""; $a = new ValueAccess($i, ["allow_empty" => false]); self::assertTrue($a->exists()); self::assertFalse($a->available()); self::assertSame($default, $a->get($default)); $i = ""; $a = new ValueAccess($i, ["allow_empty" => true]); self::assertTrue($a->exists()); self::assertTrue($a->available()); self::assertSame("", $a->get($default)); } }