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,134 +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 see LICENSE
7
- */
8
-
9
-namespace Windwalker\Renderer\Test;
10
-
11
-use League\Plates\Engine;
12
-use Windwalker\Dom\Test\AbstractDomTestCase;
13
-use Windwalker\Renderer\PlatesRenderer;
14
-
15
-/**
16
- * Test class of PlatesRenderer
17
- *
18
- * @since 2.0.9
19
- */
20
-class PlatesRendererTest extends AbstractDomTestCase
21
-{
22
-    /**
23
-     * Test instance.
24
-     *
25
-     * @var PlatesRenderer
26
-     */
27
-    protected $instance;
28
-
29
-    /**
30
-     * Property path.
31
-     *
32
-     * @var string
33
-     */
34
-    protected static $path;
35
-
36
-    /**
37
-     * Sets up the fixture, for example, opens a network connection.
38
-     * This method is called before a test is executed.
39
-     *
40
-     * @return void
41
-     */
42
-    protected function setUp(): void
43
-    {
44
-        static::$path = realpath(__DIR__ . '/Tmpl/plates');
45
-
46
-        if (!static::$path) {
47
-            throw new \RuntimeException('Path not exists');
48
-        }
49
-
50
-        $this->instance = new PlatesRenderer(static::$path);
51
-    }
52
-
53
-    /**
54
-     * Tears down the fixture, for example, closes a network connection.
55
-     * This method is called after a test is executed.
56
-     *
57
-     * @return void
58
-     */
59
-    protected function tearDown(): void
60
-    {
61
-    }
62
-
63
-    /**
64
-     * Method to test getEngine().
65
-     *
66
-     * @return void
67
-     *
68
-     * @covers \Windwalker\Renderer\PlatesRenderer::getEngine
69
-     */
70
-    public function testGetEngine()
71
-    {
72
-        $this->instance->config->set('path.found', static::$path);
73
-
74
-        $this->assertTrue($this->instance->getEngine() instanceof Engine);
75
-    }
76
-
77
-    /**
78
-     * Method to test setEngine().
79
-     *
80
-     * @return void
81
-     *
82
-     * @covers \Windwalker\Renderer\PlatesRenderer::setEngine
83
-     * @TODO   Implement testSetEngine().
84
-     */
85
-    public function testSetEngine()
86
-    {
87
-        // Remove the following lines when you implement this test.
88
-        $this->markTestIncomplete(
89
-            'This test has not been implemented yet.'
90
-        );
91
-    }
92
-
93
-    /**
94
-     * Method to test render().
95
-     *
96
-     * @return void
97
-     *
98
-     * @covers \Windwalker\Renderer\PlatesRenderer::render
99
-     */
100
-    public function testRender()
101
-    {
102
-        $html = $this->instance->render('profile', ['name' => 'Tony Stark']);
103
-
104
-        $expect = <<<HTML
105
-<html>
106
-<head>
107
-    <title>User Profile</title>
108
-</head>
109
-<body>
110
-
111
-<img src="logo.png">
112
-
113
-<div id="page">
114
-    <h1>Welcome!</h1>
115
-<p>Hello Tony Stark</p>
116
-</div>
117
-
118
-<div id="sidebar">
119
-        <ul>
120
-    <li><a href="/link">Example Link</a></li>
121
-    <li><a href="/link">Example Link</a></li>
122
-    <li><a href="/link">Example Link</a></li>
123
-    <li><a href="/link">Example Link</a></li>
124
-    <li><a href="/link">Example Link</a></li>
125
-</ul>
126
-    </div>
127
-
128
-</body>
129
-</html>
130
-HTML;
131
-
132
-        $this->assertDomStringEqualsDomString($expect, $html);
133
-    }
134
-}
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,134 @@
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 see LICENSE
7
+ */
8
+
9
+namespace Windwalker\Renderer\Test;
10
+
11
+use League\Plates\Engine;
12
+use Windwalker\Dom\Test\AbstractDomTestCase;
13
+use Windwalker\Renderer\PlatesRenderer;
14
+
15
+/**
16
+ * Test class of PlatesRenderer
17
+ *
18
+ * @since 2.0.9
19
+ */
20
+class PlatesRendererTest extends AbstractDomTestCase
21
+{
22
+    /**
23
+     * Test instance.
24
+     *
25
+     * @var PlatesRenderer
26
+     */
27
+    protected $instance;
28
+
29
+    /**
30
+     * Property path.
31
+     *
32
+     * @var string
33
+     */
34
+    protected static $path;
35
+
36
+    /**
37
+     * Sets up the fixture, for example, opens a network connection.
38
+     * This method is called before a test is executed.
39
+     *
40
+     * @return void
41
+     */
42
+    protected function setUp(): void
43
+    {
44
+        static::$path = realpath(__DIR__ . '/Tmpl/plates');
45
+
46
+        if (!static::$path) {
47
+            throw new \RuntimeException('Path not exists');
48
+        }
49
+
50
+        $this->instance = new PlatesRenderer(static::$path);
51
+    }
52
+
53
+    /**
54
+     * Tears down the fixture, for example, closes a network connection.
55
+     * This method is called after a test is executed.
56
+     *
57
+     * @return void
58
+     */
59
+    protected function tearDown(): void
60
+    {
61
+    }
62
+
63
+    /**
64
+     * Method to test getEngine().
65
+     *
66
+     * @return void
67
+     *
68
+     * @covers \Windwalker\Renderer\PlatesRenderer::getEngine
69
+     */
70
+    public function testGetEngine()
71
+    {
72
+        $this->instance->config->set('path.found', static::$path);
73
+
74
+        $this->assertTrue($this->instance->getEngine() instanceof Engine);
75
+    }
76
+
77
+    /**
78
+     * Method to test setEngine().
79
+     *
80
+     * @return void
81
+     *
82
+     * @covers \Windwalker\Renderer\PlatesRenderer::setEngine
83
+     * @TODO   Implement testSetEngine().
84
+     */
85
+    public function testSetEngine()
86
+    {
87
+        // Remove the following lines when you implement this test.
88
+        $this->markTestIncomplete(
89
+            'This test has not been implemented yet.'
90
+        );
91
+    }
92
+
93
+    /**
94
+     * Method to test render().
95
+     *
96
+     * @return void
97
+     *
98
+     * @covers \Windwalker\Renderer\PlatesRenderer::render
99
+     */
100
+    public function testRender()
101
+    {
102
+        $html = $this->instance->render('profile', ['name' => 'Tony Stark']);
103
+
104
+        $expect = <<<HTML
105
+<html>
106
+<head>
107
+    <title>User Profile</title>
108
+</head>
109
+<body>
110
+
111
+<img src="logo.png">
112
+
113
+<div id="page">
114
+    <h1>Welcome!</h1>
115
+<p>Hello Tony Stark</p>
116
+</div>
117
+
118
+<div id="sidebar">
119
+        <ul>
120
+    <li><a href="/link">Example Link</a></li>
121
+    <li><a href="/link">Example Link</a></li>
122
+    <li><a href="/link">Example Link</a></li>
123
+    <li><a href="/link">Example Link</a></li>
124
+    <li><a href="/link">Example Link</a></li>
125
+</ul>
126
+    </div>
127
+
128
+</body>
129
+</html>
130
+HTML;
131
+
132
+        $this->assertDomStringEqualsDomString($expect, $html);
133
+    }
134
+}