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); }
/** * allows you to include php templates that work even when static publishing is enabled */ function IncludePHP($tpl) { return LivePubHelper::include_php($tpl); }