Exemplo n.º 1
0
 public function test_startsWith()
 {
     //This test, tests against the function startsWith which is used to detect if a string starts in a string
     //A good example is to test if a string starts with hello in "helloworld"
     $this->assertEquals(true, Engine::startsWith("helloworld", "hello"));
     //Here we make sure it actually works by giving it a wrong value, we expect to get false
     $this->assertEquals(false, Engine::startsWith("helloworld", "world"));
 }
Exemplo n.º 2
0
 public static function getRemoteAbsolutePath($path)
 {
     //Returns nothing if the path is already an absolute address
     if (Engine::startsWith($path, "http://") || Engine::startsWith($path, "https://")) {
         return $path;
     }
     //Returns the absolute address of the provided path.
     //(e.g. /Hello/World & /Foo/Bar become http://localhost/Hello/World/Foo/Bar)
     return self::$protocol . self::$host . self::getRemoteDir($path);
 }