Exemplo n.º 1
0
    public static function expect($value, $implicitAssert = false)
    {
        return new Spec\Expect($value, $implicitAssert);
    }
    /**
     * Helper method to modify the __DIR__ constant value in spec files
     * so that it doesn't include the spec:// prefix
     *
     * Example: include Spec::dir(__DIR__) . '/fixtures/one.php';
     *
     * @static
     * @param string $dir
     */
    public static function dir($dir)
    {
        if (strpos($dir, self::SCHEME . '://') === 0) {
            $dir = substr($dir, strlen(self::SCHEME . '://'));
        } else {
            if (strpos($dir, self::SCHEME . ':') === 0) {
                $dir = substr($dir, strlen(self::SCHEME . ':'));
            }
        }
        $dir = $dir && strlen($dir) > 0 ? $dir : '.';
        $dir = realpath($dir);
        return $dir;
    }
}
// Initialize the library as soon as this file is included
if (!defined('SPEC_DO_NOT_INIT') || !SPEC_DO_NOT_INIT) {
    Spec::init();
}