@@ 7-25 (lines=19) @@ | ||
4 | ||
5 | class WidgetMinificationTest extends TestCase |
|
6 | { |
|
7 | public function test_minifies_the_output() |
|
8 | { |
|
9 | config(['widgetize.minify_html' => true]); |
|
10 | config(['widgetize.debug_info' => false]); |
|
11 | ||
12 | app()['env'] = 'local'; |
|
13 | ||
14 | $widgetOutput = ' <p> </p> '; |
|
15 | $minified = ' <p> </p> '; |
|
16 | ||
17 | View::shouldReceive('exists')->once()->andReturn(true); |
|
18 | View::shouldReceive('make')->once()->with('hello', ['data' => null], [])->andReturn(app('view')); |
|
19 | View::shouldReceive('render')->once()->andReturn($widgetOutput); |
|
20 | ||
21 | //act |
|
22 | $widget = new Widget7(); |
|
23 | $widgetOutput = render_widget($widget); |
|
24 | $this->assertEquals($minified, $widgetOutput); |
|
25 | } |
|
26 | ||
27 | public function test_minifies_the_output_in_production_with_cache_turned_off() |
|
28 | { |
|
@@ 27-44 (lines=18) @@ | ||
24 | $this->assertEquals($minified, $widgetOutput); |
|
25 | } |
|
26 | ||
27 | public function test_minifies_the_output_in_production_with_cache_turned_off() |
|
28 | { |
|
29 | config(['widgetize.minify_html' => false]); |
|
30 | config(['widgetize.debug_info' => false]); |
|
31 | app()['env'] = 'production'; |
|
32 | ||
33 | $html = ' <p> </p> '; |
|
34 | $minified = ' <p> </p> '; |
|
35 | ||
36 | View::shouldReceive('exists')->once()->andReturn(true); |
|
37 | View::shouldReceive('make')->once()->with('hello', ['data' => null], [])->andReturn(app('view')); |
|
38 | View::shouldReceive('render')->once()->andReturn($html); |
|
39 | ||
40 | //act |
|
41 | $widget = new Widget7(); |
|
42 | $html = render_widget($widget); |
|
43 | $this->assertEquals($minified, $html); |
|
44 | } |
|
45 | } |
|
46 |