File tree Expand file tree Collapse file tree 1 file changed +4
-19
lines changed
Expand file tree Collapse file tree 1 file changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -38,29 +38,14 @@ public function setUp()
3838
3939 protected function parseFile ($ file )
4040 {
41- $ path = ZEPHIR_PARSER_DATA . DIRECTORY_SEPARATOR . ltrim ($ file , '\\/ ' );
42-
41+ $ path = $ this ->dataPath ($ file );
4342 return zephir_parse_file (file_get_contents ($ path ), $ path );
4443 }
4544
46- protected function parseContent ( $ content )
45+ protected function dataPath ( $ path )
4746 {
48- $ stream = fopen ('php://memory ' ,'r+ ' );
49-
50- if (!is_resource ($ stream )) {
51- throw new PHPUnit_Framework_Exception ('Unable to create stream to prepare content ' );
52- }
53-
54- fwrite ($ stream , $ content );
55- rewind ($ stream );
56-
57- $ path = ZEPHIR_PARSER_OUTPUT . DIRECTORY_SEPARATOR . md5 ($ content ) . '.zep ' ;
58-
59- if (file_put_contents ($ path , $ stream ) === false ) {
60- throw new PHPUnit_Framework_Exception ('Unable to write content to the temporary file ' );
61- }
62-
63- return zephir_parse_file (file_get_contents ($ path ), $ path );
47+ $ normalized = str_replace (['\\' , '/ ' ], DIRECTORY_SEPARATOR , $ path );
48+ return ZEPHIR_PARSER_DATA . DIRECTORY_SEPARATOR . ltrim ($ normalized , DIRECTORY_SEPARATOR );
6449 }
6550
6651 /**
You can’t perform that action at this time.
0 commit comments