public function testReplaceTilda() { $node = new Node(); Env::set("homedir", "/home/your"); $node->setKey("~/path/to/private_key"); $this->assertEquals("~/path/to/private_key", $node->getKey()); $this->assertEquals("/home/your/path/to/private_key", $node->getKeyOrDefault()); $node->setKey("~user/path/to/private_key"); $this->assertEquals("~user/path/to/private_key", $node->getKey()); $this->assertEquals("~user/path/to/private_key", $node->getKeyOrDefault()); $node->setKey("~"); $this->assertEquals("~", $node->getKey()); $this->assertEquals("/home/your", $node->getKeyOrDefault()); Env::set("homedir", "/home/your\\0"); $node->setKey("~/path/to/private_key"); $this->assertEquals("~/path/to/private_key", $node->getKey()); $this->assertEquals("/home/your\\0/path/to/private_key", $node->getKeyOrDefault()); $node->setKey("/path/to/private_key~"); $this->assertEquals("/path/to/private_key~", $node->getKey()); $this->assertEquals("/path/to/private_key~", $node->getKeyOrDefault()); }
public function testSetAndGet() { Env::set("aaa", "bbb"); $this->assertEquals("bbb", Env::get("aaa")); }