Avail feature updated
[ninja.git] / application / helpers / unittest.php
blob3a9d87aca7aab90b3256ab55f6296d1d409c71d6
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Kohana help class for unit tests
5 * @author op5 AB
6 */
7 class unittest {
9 private static $tap = false;
10 /**
11 * Create and return a new PHPTap instance
13 * @return object
15 public static function instance()
17 if (self::$tap !== false)
18 return self::$tap;
20 $path = self::tap_path();
21 if ($path !== false) {
22 require_once($path);
23 self::$tap = new phptap();
24 return self::$tap;
26 return false;
29 /**
30 * Check if testfile is available
32 public static function get_testfile($file = false)
34 $file = trim($file);
35 if (empty($file))
36 return false;
38 return Kohana::find_file('views', 'tests/'.$file);
41 /**
42 * Return path to phptap
44 public static function tap_path()
46 return Kohana::find_file('vendor', 'phptap/tapunit');