realpath(dirname(__FILE__).'/../test_data/') ]; Kohana::modules($new_modules); } /** * Restores the module list * * @return null */ // @codingStandardsIgnoreStart public static function teardownAfterClass(): void // @codingStandardsIgnoreEnd { Kohana::modules(self::$old_modules); } /** * Provider for test_instaniate * * @return array */ public function provider_instantiate() { return [ ['kohana/error', FALSE], ['test.css', FALSE], ['doesnt_exist', TRUE], ]; } /** * Provider to test_set * * @return array */ public function provider_set() { return [ ['foo', 'bar', 'foo', 'bar'], [['foo' => 'bar'], NULL, 'foo', 'bar'], [new ArrayIterator(['foo' => 'bar']), NULL, 'foo', 'bar'], ]; } /** * Tests that we can instantiate a view file * * @test * @dataProvider provider_instantiate * * @return null */ public function test_instantiate($path, $expects_exception) { try { $view = new View($path); $this->assertSame(FALSE, $expects_exception); } catch(View_Exception $e) { $this->assertSame(TRUE, $expects_exception); } } /** * Tests that we can set using string, array or Traversable object * * @test * @dataProvider provider_set * * @return null */ public function test_set($data_key, $value, $test_key, $expected) { $view = View::factory()->set($data_key, $value); $this->assertSame($expected, $view->$test_key); } /** * Tests that we can set global using string, array or Traversable object * * @test * @dataProvider provider_set * * @return null */ public function test_set_global($data_key, $value, $test_key, $expected) { $view = View::factory(); $view::set_global($data_key, $value); $this->assertSame($expected, $view->$test_key); } }