Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

Application modulaire fonctionnelle !

Emmanuel ROY authored on 12/08/2019 15:10:25
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,301 +0,0 @@
1
-<?php declare(strict_types=1);
2
-/**
3
- * Part of Windwalker project Test files.  @codingStandardsIgnoreStart
4
- *
5
- * @copyright  Copyright (C) 2019 LYRASOFT Taiwan, Inc.
6
- * @license    LGPL-2.0-or-later
7
- */
8
-
9
-namespace Windwalker\Renderer\Test;
10
-
11
-use Illuminate\Contracts\View\Factory;
12
-use Windwalker\Dom\Test\AbstractDomTestCase;
13
-use Windwalker\Filesystem\Filesystem;
14
-use Windwalker\Filesystem\Folder;
15
-use Windwalker\Renderer\BladeRenderer;
16
-
17
-/**
18
- * Test class of BladeRenderer
19
- *
20
- * @since 2.0
21
- */
22
-class BladeRendererTest extends AbstractDomTestCase
23
-{
24
-    /**
25
-     * Test instance.
26
-     *
27
-     * @var BladeRenderer
28
-     */
29
-    protected $instance;
30
-
31
-    /**
32
-     * Property path.
33
-     *
34
-     * @var string
35
-     */
36
-    protected static $path;
37
-
38
-    /**
39
-     * Sets up the fixture, for example, opens a network connection.
40
-     * This method is called before a test is executed.
41
-     *
42
-     * @return void
43
-     */
44
-    protected function setUp(): void
45
-    {
46
-        static::$path = realpath(__DIR__ . '/Tmpl/blade');
47
-
48
-        if (!static::$path) {
49
-            throw new \RuntimeException('Path not exists');
50
-        }
51
-
52
-        Folder::create(__DIR__ . '/cache');
53
-
54
-        $this->instance = new BladeRenderer(static::$path, ['cache_path' => __DIR__ . '/cache']);
55
-    }
56
-
57
-    /**
58
-     * Tears down the fixture, for example, closes a network connection.
59
-     * This method is called after a test is executed.
60
-     *
61
-     * @return void
62
-     */
63
-    protected function tearDown(): void
64
-    {
65
-        Filesystem::delete(__DIR__ . '/cache');
66
-    }
67
-
68
-    /**
69
-     * Destructor
70
-     */
71
-    public function __destruct()
72
-    {
73
-        Filesystem::delete(__DIR__ . '/cache');
74
-    }
75
-
76
-    /**
77
-     * Method to test render().
78
-     *
79
-     * @return void
80
-     *
81
-     * @covers \Windwalker\Renderer\BladeRenderer::render
82
-     */
83
-    public function testRender()
84
-    {
85
-        $html = $this->instance->render('hello');
86
-
87
-        $expect = <<<HTML
88
-<html>
89
-<body>
90
-    This is the master sidebar.
91
-
92
-    <p>This is appended to the master sidebar.</p>
93
-    <div class="container">
94
-        <p>This is my body content.</p>
95
-    </div>
96
-</body>
97
-</html>
98
-HTML;
99
-
100
-        $this->assertHtmlFormatEquals($expect, $html);
101
-    }
102
-
103
-    /**
104
-     * testAddCompilers
105
-     *
106
-     * @return  void
107
-     */
108
-    public function testAddCompilers()
109
-    {
110
-        $this->instance->addCustomCompiler(
111
-            'upper',
112
-            function ($expression) {
113
-                return "<?php echo strtoupper({$expression}); ?>";
114
-            }
115
-        );
116
-
117
-        $expect = <<<HTML
118
-<html>
119
-<body>
120
-    This is the master sidebar.
121
-
122
-    <p>This is appended to the master sidebar.</p>
123
-    <div class="container">
124
-        <p>THIS IS MY BODY CONTENT.</p>
125
-    </div>
126
-</body>
127
-</html>
128
-HTML;
129
-
130
-        $html = $this->instance->render('compiler');
131
-
132
-        $this->assertHtmlFormatEquals($expect, $html);
133
-    }
134
-
135
-    /**
136
-     * Method to test getBlade().
137
-     *
138
-     * @return void
139
-     *
140
-     * @covers \Windwalker\Renderer\BladeRenderer::getEngine
141
-     */
142
-    public function testGetBlade()
143
-    {
144
-        $this->assertInstanceOf(Factory::class, $this->instance->getEngine());
145
-    }
146
-
147
-    /**
148
-     * Method to test setBlade().
149
-     *
150
-     * @return void
151
-     *
152
-     * @covers \Windwalker\Renderer\BladeRenderer::setEngine
153
-     * @TODO   Implement testSetBlade().
154
-     */
155
-    public function testSetBlade()
156
-    {
157
-        // Remove the following lines when you implement this test.
158
-        $this->markTestIncomplete(
159
-            'This test has not been implemented yet.'
160
-        );
161
-    }
162
-
163
-    /**
164
-     * Method to test getFilesystem().
165
-     *
166
-     * @return void
167
-     *
168
-     * @covers \Windwalker\Renderer\BladeRenderer::getFilesystem
169
-     */
170
-    public function testGetFilesystem()
171
-    {
172
-        $this->assertInstanceOf(\Illuminate\Filesystem\Filesystem::class, $this->instance->getFilesystem());
173
-    }
174
-
175
-    /**
176
-     * Method to test setFilesystem().
177
-     *
178
-     * @return void
179
-     *
180
-     * @covers \Windwalker\Renderer\BladeRenderer::setFilesystem
181
-     * @TODO   Implement testSetFilesystem().
182
-     */
183
-    public function testSetFilesystem()
184
-    {
185
-        // Remove the following lines when you implement this test.
186
-        $this->markTestIncomplete(
187
-            'This test has not been implemented yet.'
188
-        );
189
-    }
190
-
191
-    /**
192
-     * Method to test getFinder().
193
-     *
194
-     * @return void
195
-     *
196
-     * @covers \Windwalker\Renderer\BladeRenderer::getFinder
197
-     */
198
-    public function testGetFinder()
199
-    {
200
-        $this->assertInstanceOf('Illuminate\View\FileViewFinder', $this->instance->getFinder());
201
-    }
202
-
203
-    /**
204
-     * Method to test setFinder().
205
-     *
206
-     * @return void
207
-     *
208
-     * @covers \Windwalker\Renderer\BladeRenderer::setFinder
209
-     * @TODO   Implement testSetFinder().
210
-     */
211
-    public function testSetFinder()
212
-    {
213
-        // Remove the following lines when you implement this test.
214
-        $this->markTestIncomplete(
215
-            'This test has not been implemented yet.'
216
-        );
217
-    }
218
-
219
-    /**
220
-     * Method to test getResolver().
221
-     *
222
-     * @return void
223
-     *
224
-     * @covers \Windwalker\Renderer\BladeRenderer::getResolver
225
-     */
226
-    public function testGetResolver()
227
-    {
228
-        $this->assertInstanceOf('Illuminate\View\Engines\EngineResolver', $this->instance->getResolver());
229
-    }
230
-
231
-    /**
232
-     * Method to test setResolver().
233
-     *
234
-     * @return void
235
-     *
236
-     * @covers \Windwalker\Renderer\BladeRenderer::setResolver
237
-     */
238
-    public function testSetResolver()
239
-    {
240
-        // Remove the following lines when you implement this test.
241
-        $this->markTestIncomplete(
242
-            'This test has not been implemented yet.'
243
-        );
244
-    }
245
-
246
-    /**
247
-     * Method to test getDispatcher().
248
-     *
249
-     * @return void
250
-     *
251
-     * @covers \Windwalker\Renderer\BladeRenderer::getDispatcher
252
-     */
253
-    public function testGetDispatcher()
254
-    {
255
-        $this->assertInstanceOf('Illuminate\Events\Dispatcher', $this->instance->getDispatcher());
256
-    }
257
-
258
-    /**
259
-     * Method to test setDispatcher().
260
-     *
261
-     * @return void
262
-     *
263
-     * @covers \Windwalker\Renderer\BladeRenderer::setDispatcher
264
-     * @TODO   Implement testSetDispatcher().
265
-     */
266
-    public function testSetDispatcher()
267
-    {
268
-        // Remove the following lines when you implement this test.
269
-        $this->markTestIncomplete(
270
-            'This test has not been implemented yet.'
271
-        );
272
-    }
273
-
274
-    /**
275
-     * Method to test getCompiler().
276
-     *
277
-     * @return void
278
-     *
279
-     * @covers \Windwalker\Renderer\BladeRenderer::getCompiler
280
-     */
281
-    public function testGetCompiler()
282
-    {
283
-        $this->assertInstanceOf('Illuminate\View\Engines\CompilerEngine', $this->instance->getCompiler());
284
-    }
285
-
286
-    /**
287
-     * Method to test setCompiler().
288
-     *
289
-     * @return void
290
-     *
291
-     * @covers \Windwalker\Renderer\BladeRenderer::setCompiler
292
-     * @TODO   Implement testSetCompiler().
293
-     */
294
-    public function testSetCompiler()
295
-    {
296
-        // Remove the following lines when you implement this test.
297
-        $this->markTestIncomplete(
298
-            'This test has not been implemented yet.'
299
-        );
300
-    }
301
-}
Browse code

initial commit

Emmanuel ROY authored on 09/08/2019 08:39:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,301 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Part of Windwalker project Test files.  @codingStandardsIgnoreStart
4
+ *
5
+ * @copyright  Copyright (C) 2019 LYRASOFT Taiwan, Inc.
6
+ * @license    LGPL-2.0-or-later
7
+ */
8
+
9
+namespace Windwalker\Renderer\Test;
10
+
11
+use Illuminate\Contracts\View\Factory;
12
+use Windwalker\Dom\Test\AbstractDomTestCase;
13
+use Windwalker\Filesystem\Filesystem;
14
+use Windwalker\Filesystem\Folder;
15
+use Windwalker\Renderer\BladeRenderer;
16
+
17
+/**
18
+ * Test class of BladeRenderer
19
+ *
20
+ * @since 2.0
21
+ */
22
+class BladeRendererTest extends AbstractDomTestCase
23
+{
24
+    /**
25
+     * Test instance.
26
+     *
27
+     * @var BladeRenderer
28
+     */
29
+    protected $instance;
30
+
31
+    /**
32
+     * Property path.
33
+     *
34
+     * @var string
35
+     */
36
+    protected static $path;
37
+
38
+    /**
39
+     * Sets up the fixture, for example, opens a network connection.
40
+     * This method is called before a test is executed.
41
+     *
42
+     * @return void
43
+     */
44
+    protected function setUp(): void
45
+    {
46
+        static::$path = realpath(__DIR__ . '/Tmpl/blade');
47
+
48
+        if (!static::$path) {
49
+            throw new \RuntimeException('Path not exists');
50
+        }
51
+
52
+        Folder::create(__DIR__ . '/cache');
53
+
54
+        $this->instance = new BladeRenderer(static::$path, ['cache_path' => __DIR__ . '/cache']);
55
+    }
56
+
57
+    /**
58
+     * Tears down the fixture, for example, closes a network connection.
59
+     * This method is called after a test is executed.
60
+     *
61
+     * @return void
62
+     */
63
+    protected function tearDown(): void
64
+    {
65
+        Filesystem::delete(__DIR__ . '/cache');
66
+    }
67
+
68
+    /**
69
+     * Destructor
70
+     */
71
+    public function __destruct()
72
+    {
73
+        Filesystem::delete(__DIR__ . '/cache');
74
+    }
75
+
76
+    /**
77
+     * Method to test render().
78
+     *
79
+     * @return void
80
+     *
81
+     * @covers \Windwalker\Renderer\BladeRenderer::render
82
+     */
83
+    public function testRender()
84
+    {
85
+        $html = $this->instance->render('hello');
86
+
87
+        $expect = <<<HTML
88
+<html>
89
+<body>
90
+    This is the master sidebar.
91
+
92
+    <p>This is appended to the master sidebar.</p>
93
+    <div class="container">
94
+        <p>This is my body content.</p>
95
+    </div>
96
+</body>
97
+</html>
98
+HTML;
99
+
100
+        $this->assertHtmlFormatEquals($expect, $html);
101
+    }
102
+
103
+    /**
104
+     * testAddCompilers
105
+     *
106
+     * @return  void
107
+     */
108
+    public function testAddCompilers()
109
+    {
110
+        $this->instance->addCustomCompiler(
111
+            'upper',
112
+            function ($expression) {
113
+                return "<?php echo strtoupper({$expression}); ?>";
114
+            }
115
+        );
116
+
117
+        $expect = <<<HTML
118
+<html>
119
+<body>
120
+    This is the master sidebar.
121
+
122
+    <p>This is appended to the master sidebar.</p>
123
+    <div class="container">
124
+        <p>THIS IS MY BODY CONTENT.</p>
125
+    </div>
126
+</body>
127
+</html>
128
+HTML;
129
+
130
+        $html = $this->instance->render('compiler');
131
+
132
+        $this->assertHtmlFormatEquals($expect, $html);
133
+    }
134
+
135
+    /**
136
+     * Method to test getBlade().
137
+     *
138
+     * @return void
139
+     *
140
+     * @covers \Windwalker\Renderer\BladeRenderer::getEngine
141
+     */
142
+    public function testGetBlade()
143
+    {
144
+        $this->assertInstanceOf(Factory::class, $this->instance->getEngine());
145
+    }
146
+
147
+    /**
148
+     * Method to test setBlade().
149
+     *
150
+     * @return void
151
+     *
152
+     * @covers \Windwalker\Renderer\BladeRenderer::setEngine
153
+     * @TODO   Implement testSetBlade().
154
+     */
155
+    public function testSetBlade()
156
+    {
157
+        // Remove the following lines when you implement this test.
158
+        $this->markTestIncomplete(
159
+            'This test has not been implemented yet.'
160
+        );
161
+    }
162
+
163
+    /**
164
+     * Method to test getFilesystem().
165
+     *
166
+     * @return void
167
+     *
168
+     * @covers \Windwalker\Renderer\BladeRenderer::getFilesystem
169
+     */
170
+    public function testGetFilesystem()
171
+    {
172
+        $this->assertInstanceOf(\Illuminate\Filesystem\Filesystem::class, $this->instance->getFilesystem());
173
+    }
174
+
175
+    /**
176
+     * Method to test setFilesystem().
177
+     *
178
+     * @return void
179
+     *
180
+     * @covers \Windwalker\Renderer\BladeRenderer::setFilesystem
181
+     * @TODO   Implement testSetFilesystem().
182
+     */
183
+    public function testSetFilesystem()
184
+    {
185
+        // Remove the following lines when you implement this test.
186
+        $this->markTestIncomplete(
187
+            'This test has not been implemented yet.'
188
+        );
189
+    }
190
+
191
+    /**
192
+     * Method to test getFinder().
193
+     *
194
+     * @return void
195
+     *
196
+     * @covers \Windwalker\Renderer\BladeRenderer::getFinder
197
+     */
198
+    public function testGetFinder()
199
+    {
200
+        $this->assertInstanceOf('Illuminate\View\FileViewFinder', $this->instance->getFinder());
201
+    }
202
+
203
+    /**
204
+     * Method to test setFinder().
205
+     *
206
+     * @return void
207
+     *
208
+     * @covers \Windwalker\Renderer\BladeRenderer::setFinder
209
+     * @TODO   Implement testSetFinder().
210
+     */
211
+    public function testSetFinder()
212
+    {
213
+        // Remove the following lines when you implement this test.
214
+        $this->markTestIncomplete(
215
+            'This test has not been implemented yet.'
216
+        );
217
+    }
218
+
219
+    /**
220
+     * Method to test getResolver().
221
+     *
222
+     * @return void
223
+     *
224
+     * @covers \Windwalker\Renderer\BladeRenderer::getResolver
225
+     */
226
+    public function testGetResolver()
227
+    {
228
+        $this->assertInstanceOf('Illuminate\View\Engines\EngineResolver', $this->instance->getResolver());
229
+    }
230
+
231
+    /**
232
+     * Method to test setResolver().
233
+     *
234
+     * @return void
235
+     *
236
+     * @covers \Windwalker\Renderer\BladeRenderer::setResolver
237
+     */
238
+    public function testSetResolver()
239
+    {
240
+        // Remove the following lines when you implement this test.
241
+        $this->markTestIncomplete(
242
+            'This test has not been implemented yet.'
243
+        );
244
+    }
245
+
246
+    /**
247
+     * Method to test getDispatcher().
248
+     *
249
+     * @return void
250
+     *
251
+     * @covers \Windwalker\Renderer\BladeRenderer::getDispatcher
252
+     */
253
+    public function testGetDispatcher()
254
+    {
255
+        $this->assertInstanceOf('Illuminate\Events\Dispatcher', $this->instance->getDispatcher());
256
+    }
257
+
258
+    /**
259
+     * Method to test setDispatcher().
260
+     *
261
+     * @return void
262
+     *
263
+     * @covers \Windwalker\Renderer\BladeRenderer::setDispatcher
264
+     * @TODO   Implement testSetDispatcher().
265
+     */
266
+    public function testSetDispatcher()
267
+    {
268
+        // Remove the following lines when you implement this test.
269
+        $this->markTestIncomplete(
270
+            'This test has not been implemented yet.'
271
+        );
272
+    }
273
+
274
+    /**
275
+     * Method to test getCompiler().
276
+     *
277
+     * @return void
278
+     *
279
+     * @covers \Windwalker\Renderer\BladeRenderer::getCompiler
280
+     */
281
+    public function testGetCompiler()
282
+    {
283
+        $this->assertInstanceOf('Illuminate\View\Engines\CompilerEngine', $this->instance->getCompiler());
284
+    }
285
+
286
+    /**
287
+     * Method to test setCompiler().
288
+     *
289
+     * @return void
290
+     *
291
+     * @covers \Windwalker\Renderer\BladeRenderer::setCompiler
292
+     * @TODO   Implement testSetCompiler().
293
+     */
294
+    public function testSetCompiler()
295
+    {
296
+        // Remove the following lines when you implement this test.
297
+        $this->markTestIncomplete(
298
+            'This test has not been implemented yet.'
299
+        );
300
+    }
301
+}