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,95 +0,0 @@
1
-<?php
2
-
3
-/*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
-namespace Symfony\Component\Finder\Tests;
13
-
14
-use PHPUnit\Framework\TestCase;
15
-use Symfony\Component\Finder\Finder;
16
-use Symfony\Component\Finder\Glob;
17
-
18
-class GlobTest extends TestCase
19
-{
20
-    public function testGlobToRegexDelimiters()
21
-    {
22
-        $this->assertEquals('#^(?=[^\.])\#$#', Glob::toRegex('#'));
23
-        $this->assertEquals('#^\.[^/]*$#', Glob::toRegex('.*'));
24
-        $this->assertEquals('^\.[^/]*$', Glob::toRegex('.*', true, true, ''));
25
-        $this->assertEquals('/^\.[^/]*$/', Glob::toRegex('.*', true, true, '/'));
26
-    }
27
-
28
-    public function testGlobToRegexDoubleStarStrictDots()
29
-    {
30
-        $finder = new Finder();
31
-        $finder->ignoreDotFiles(false);
32
-        $regex = Glob::toRegex('/**/*.neon');
33
-
34
-        foreach ($finder->in(__DIR__) as $k => $v) {
35
-            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
36
-            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
37
-                $match[] = substr($k, 10 + \strlen(__DIR__));
38
-            }
39
-        }
40
-        sort($match);
41
-
42
-        $this->assertSame(['one/b/c.neon', 'one/b/d.neon'], $match);
43
-    }
44
-
45
-    public function testGlobToRegexDoubleStarNonStrictDots()
46
-    {
47
-        $finder = new Finder();
48
-        $finder->ignoreDotFiles(false);
49
-        $regex = Glob::toRegex('/**/*.neon', false);
50
-
51
-        foreach ($finder->in(__DIR__) as $k => $v) {
52
-            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
53
-            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
54
-                $match[] = substr($k, 10 + \strlen(__DIR__));
55
-            }
56
-        }
57
-        sort($match);
58
-
59
-        $this->assertSame(['.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'], $match);
60
-    }
61
-
62
-    public function testGlobToRegexDoubleStarWithoutLeadingSlash()
63
-    {
64
-        $finder = new Finder();
65
-        $finder->ignoreDotFiles(false);
66
-        $regex = Glob::toRegex('/Fixtures/one/**');
67
-
68
-        foreach ($finder->in(__DIR__) as $k => $v) {
69
-            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
70
-            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
71
-                $match[] = substr($k, 10 + \strlen(__DIR__));
72
-            }
73
-        }
74
-        sort($match);
75
-
76
-        $this->assertSame(['one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
77
-    }
78
-
79
-    public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot()
80
-    {
81
-        $finder = new Finder();
82
-        $finder->ignoreDotFiles(false);
83
-        $regex = Glob::toRegex('/Fixtures/one/**', false);
84
-
85
-        foreach ($finder->in(__DIR__) as $k => $v) {
86
-            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
87
-            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
88
-                $match[] = substr($k, 10 + \strlen(__DIR__));
89
-            }
90
-        }
91
-        sort($match);
92
-
93
-        $this->assertSame(['one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
94
-    }
95
-}
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,95 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+namespace Symfony\Component\Finder\Tests;
13
+
14
+use PHPUnit\Framework\TestCase;
15
+use Symfony\Component\Finder\Finder;
16
+use Symfony\Component\Finder\Glob;
17
+
18
+class GlobTest extends TestCase
19
+{
20
+    public function testGlobToRegexDelimiters()
21
+    {
22
+        $this->assertEquals('#^(?=[^\.])\#$#', Glob::toRegex('#'));
23
+        $this->assertEquals('#^\.[^/]*$#', Glob::toRegex('.*'));
24
+        $this->assertEquals('^\.[^/]*$', Glob::toRegex('.*', true, true, ''));
25
+        $this->assertEquals('/^\.[^/]*$/', Glob::toRegex('.*', true, true, '/'));
26
+    }
27
+
28
+    public function testGlobToRegexDoubleStarStrictDots()
29
+    {
30
+        $finder = new Finder();
31
+        $finder->ignoreDotFiles(false);
32
+        $regex = Glob::toRegex('/**/*.neon');
33
+
34
+        foreach ($finder->in(__DIR__) as $k => $v) {
35
+            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
36
+            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
37
+                $match[] = substr($k, 10 + \strlen(__DIR__));
38
+            }
39
+        }
40
+        sort($match);
41
+
42
+        $this->assertSame(['one/b/c.neon', 'one/b/d.neon'], $match);
43
+    }
44
+
45
+    public function testGlobToRegexDoubleStarNonStrictDots()
46
+    {
47
+        $finder = new Finder();
48
+        $finder->ignoreDotFiles(false);
49
+        $regex = Glob::toRegex('/**/*.neon', false);
50
+
51
+        foreach ($finder->in(__DIR__) as $k => $v) {
52
+            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
53
+            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
54
+                $match[] = substr($k, 10 + \strlen(__DIR__));
55
+            }
56
+        }
57
+        sort($match);
58
+
59
+        $this->assertSame(['.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'], $match);
60
+    }
61
+
62
+    public function testGlobToRegexDoubleStarWithoutLeadingSlash()
63
+    {
64
+        $finder = new Finder();
65
+        $finder->ignoreDotFiles(false);
66
+        $regex = Glob::toRegex('/Fixtures/one/**');
67
+
68
+        foreach ($finder->in(__DIR__) as $k => $v) {
69
+            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
70
+            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
71
+                $match[] = substr($k, 10 + \strlen(__DIR__));
72
+            }
73
+        }
74
+        sort($match);
75
+
76
+        $this->assertSame(['one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
77
+    }
78
+
79
+    public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot()
80
+    {
81
+        $finder = new Finder();
82
+        $finder->ignoreDotFiles(false);
83
+        $regex = Glob::toRegex('/Fixtures/one/**', false);
84
+
85
+        foreach ($finder->in(__DIR__) as $k => $v) {
86
+            $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
87
+            if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
88
+                $match[] = substr($k, 10 + \strlen(__DIR__));
89
+            }
90
+        }
91
+        sort($match);
92
+
93
+        $this->assertSame(['one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
94
+    }
95
+}