Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/test/ParserTestCase.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 5fb285c0d0e3 |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
18 class ParserTestCase extends \PHPUnit\Framework\TestCase | 18 class ParserTestCase extends \PHPUnit\Framework\TestCase |
19 { | 19 { |
20 protected $traverser; | 20 protected $traverser; |
21 private $parser; | 21 private $parser; |
22 private $printer; | 22 private $printer; |
23 | |
24 public function tearDown() | |
25 { | |
26 $this->traverser = null; | |
27 $this->parser = null; | |
28 $this->printer = null; | |
29 } | |
23 | 30 |
24 protected function parse($code, $prefix = '<?php ') | 31 protected function parse($code, $prefix = '<?php ') |
25 { | 32 { |
26 $code = $prefix . $code; | 33 $code = $prefix . $code; |
27 try { | 34 try { |
56 | 63 |
57 protected function assertProcessesAs($from, $to) | 64 protected function assertProcessesAs($from, $to) |
58 { | 65 { |
59 $stmts = $this->parse($from); | 66 $stmts = $this->parse($from); |
60 $stmts = $this->traverse($stmts); | 67 $stmts = $this->traverse($stmts); |
61 $this->assertSame($to, $this->prettyPrint($stmts)); | 68 $toStmts = $this->parse($to); |
69 $this->assertSame($this->prettyPrint($toStmts), $this->prettyPrint($stmts)); | |
62 } | 70 } |
63 | 71 |
64 private function getParser() | 72 private function getParser() |
65 { | 73 { |
66 if (!isset($this->parser)) { | 74 if (!isset($this->parser)) { |