public function testIncludePhp() { LivePubHelper::$template_path = array(dirname(__FILE__)); // not publishing $str = LivePubHelper::include_php('TestPhpTemplate'); $this->assertEquals($str, 'Hello World'); // publishing LivePubHelper::init_pub(); $str = LivePubHelper::include_php('TestPhpTemplate'); $this->assertEquals($str, '<?php include "' . dirname(__FILE__) . '/TestPhpTemplate.php"; ?>'); LivePubHelper::stop_pub(); // check for exception on template not found $wasThrown = false; try { LivePubHelper::include_php('ThisTemplateDoesntExist'); } catch (Exception $e) { $wasThrown = true; } $this->assertTrue($wasThrown); }
/** * @param array $paths */ public static function set_template_paths(array $paths) { self::$template_path = $paths; }