1 | <?php |
||
13 | abstract class TestCase extends PHPUnit_Framework_TestCase |
||
14 | { |
||
15 | /** |
||
16 | * Mock Yii application. |
||
17 | */ |
||
18 | protected function setUp() |
||
23 | |||
24 | /** |
||
25 | * Clean up after test. |
||
26 | * By default the application created with [[mockWebApplication]] will be destroyed. |
||
27 | */ |
||
28 | protected function tearDown() |
||
33 | |||
34 | /** |
||
35 | * Populates Yii::$app with a new application. |
||
36 | * The application will be destroyed on tearDown() automatically. |
||
37 | * @param array $config the application configuration, if needed |
||
38 | * @param string $appClass name of the application class to create |
||
39 | */ |
||
40 | protected static function mockWebApplication($config = [], $appClass = 'yii\web\Application') |
||
62 | |||
63 | /** |
||
64 | * Get path to "vendor" directory. |
||
65 | * @return string path to "vendor" directory. |
||
66 | */ |
||
67 | protected static function getVendorPath() |
||
71 | |||
72 | /** |
||
73 | * Get path to tests "runtime" directory. |
||
74 | * @return string path to tests "runtime" directory. |
||
75 | */ |
||
76 | protected static function getTestsRuntimePath() |
||
80 | |||
81 | /** |
||
82 | * Destroys application in Yii::$app by setting it to null. |
||
83 | */ |
||
84 | protected static function destroyApplication() |
||
88 | |||
89 | /** |
||
90 | * Asserts that the contents of a string is equal to the contents of a HTML file. |
||
91 | * @param string $methodName name of test method |
||
92 | * @param string $actualString |
||
93 | * @param string $message |
||
94 | * @param boolean $canonicalize |
||
95 | * @param boolean $ignoreCase |
||
96 | */ |
||
97 | public static function assertStringEqualsHtmlFile( |
||
112 | |||
113 | /** |
||
114 | * Asserts that the contents of a string is equal to the contents of a JavaScript file. |
||
115 | * @param string $methodName name of test method |
||
116 | * @param string $actualString |
||
117 | * @param string $message |
||
118 | * @param boolean $canonicalize |
||
119 | * @param boolean $ignoreCase |
||
120 | */ |
||
121 | public static function assertStringEqualsJsFile( |
||
136 | |||
137 | /** |
||
138 | * Call a user function given with an array of parameters and catch its output. |
||
139 | * @param callable $callback function to be called |
||
140 | * @param array $arguments parameters to be passed to the function, as an indexed array |
||
141 | * @return array array containing result returned by function and its output. |
||
142 | * @throws \Exception |
||
143 | */ |
||
144 | public static function catchOutput($callback, $arguments = []) |
||
161 | } |
||
162 |