|
10 | 10 |
|
11 | 11 | class CascadeTest extends TestCase |
12 | 12 | { |
13 | | - public function tearDown(): void |
| 13 | + protected function tearDown(): void |
14 | 14 | { |
15 | 15 | if ($this->files->exists($path = base_path('custom_seo.yaml'))) { |
16 | 16 | $this->files->delete($path); |
@@ -126,6 +126,49 @@ public function it_parses_antlers() |
126 | 126 | $this->assertEquals('RED', $data['description']); |
127 | 127 | } |
128 | 128 |
|
| 129 | + public static function phpInAntlersProvider() |
| 130 | + { |
| 131 | + return [ |
| 132 | + [ |
| 133 | + '{{? echo "php used" ?}}', |
| 134 | + '{{? echo "php used" ?}}', |
| 135 | + ], |
| 136 | + [ |
| 137 | + '{{$ "php used" $}}', |
| 138 | + '{{$ "php used" $}}', |
| 139 | + ], |
| 140 | + [ |
| 141 | + "{{ _php_used = '@{@{' + '? echo \"php used\" ?' + '@}}'; _php_used | antlers /}}", |
| 142 | + '{{? echo "php used" ?}}', |
| 143 | + ], |
| 144 | + [ |
| 145 | + "{{ _php_used = (['' => ''] | json); _open = (_php_used | at(0)); _close = (_php_used | at(6)); _antlers_modified = _open + _open + '? echo \"php used\" ?' + _close + _close; _antlers_modified | antlers /}}", |
| 146 | + '{{? echo "php used" ?}}', |
| 147 | + ], |
| 148 | + ]; |
| 149 | + } |
| 150 | + |
| 151 | + /** |
| 152 | + * @test |
| 153 | + * |
| 154 | + * @dataProvider phpInAntlersProvider |
| 155 | + */ |
| 156 | + public function it_doesnt_parse_php_in_antlers($antlers, $output) |
| 157 | + { |
| 158 | + $entry = Entry::findByUri('/about')->entry(); |
| 159 | + |
| 160 | + $data = (new Cascade) |
| 161 | + ->with(SiteDefaults::load()->all()) |
| 162 | + ->with([ |
| 163 | + 'description' => $antlers, |
| 164 | + ]) |
| 165 | + ->withCurrent($entry) |
| 166 | + ->get(); |
| 167 | + |
| 168 | + $this->assertNotEquals('hello', $data['description']); |
| 169 | + $this->assertEquals($output, $data['description']); |
| 170 | + } |
| 171 | + |
129 | 172 | /** @test */ |
130 | 173 | public function it_parses_field_references() |
131 | 174 | { |
|
0 commit comments