Root/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <?php class PHPParser_Tests_TemplateLoaderTest extends PHPUnit_Framework_TestCase { public function testLoadWithoutSuffix() { $templateLoader = new PHPParser_TemplateLoader( new PHPParser_Parser( new PHPParser_Lexer), dirname( __FILE__ ) ); // load this file as a template, as we don't really care about the contents $template = $templateLoader ->load( 'TemplateLoaderTest.php' ); $this ->assertInstanceOf( 'PHPParser_Template' , $template ); } public function testLoadWithSuffix() { $templateLoader = new PHPParser_TemplateLoader( new PHPParser_Parser( new PHPParser_Lexer), dirname( __FILE__ ), '.php' ); // load this file as a template, as we don't really care about the contents $template = $templateLoader ->load( 'TemplateLoaderTest' ); $this ->assertInstanceOf( 'PHPParser_Template' , $template ); } /** * @expectedException InvalidArgumentException */ public function testNonexistentBaseDirectoryError() { new PHPParser_TemplateLoader( new PHPParser_Parser( new PHPParser_Lexer), dirname( __FILE__ ) . '/someDirectoryThatDoesNotExist' ); } /** * @expectedException InvalidArgumentException */ public function testNonexistentFileError() { $templateLoader = new PHPParser_TemplateLoader( new PHPParser_Parser( new PHPParser_Lexer), dirname( __FILE__ ) ); $templateLoader ->load( 'SomeTemplateThatDoesNotExist' ); } } |