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,118 +0,0 @@
1
-<?php
2
-/*
3
- * This file is part of the Symfony package.
4
- *
5
- * (c) Fabien Potencier <fabien@symfony.com>
6
- *
7
- * For the full copyright and license information, please view the LICENSE
8
- * file that was distributed with this source code.
9
- */
10
-
11
-namespace Symfony\Component\Finder\Tests;
12
-
13
-use PHPUnit\Framework\TestCase;
14
-use Symfony\Component\Finder\Gitignore;
15
-
16
-class GitignoreTest extends TestCase
17
-{
18
-    /**
19
-     * @dataProvider provider
20
-     *
21
-     * @param string $patterns
22
-     * @param array  $matchingCases
23
-     * @param array  $nonMatchingCases
24
-     */
25
-    public function testCases(string $patterns, array $matchingCases, array $nonMatchingCases)
26
-    {
27
-        $regex = Gitignore::toRegex($patterns);
28
-
29
-        foreach ($matchingCases as $matchingCase) {
30
-            $this->assertRegExp($regex, $matchingCase, sprintf('Failed asserting path [%s] matches gitignore patterns [%s] using regex [%s]', $matchingCase, $patterns, $regex));
31
-        }
32
-
33
-        foreach ($nonMatchingCases as $nonMatchingCase) {
34
-            $this->assertNotRegExp($regex, $nonMatchingCase, sprintf('Failed asserting path [%s] not matching gitignore patterns [%s] using regex [%s]', $nonMatchingCase, $patterns, $regex));
35
-        }
36
-    }
37
-
38
-    /**
39
-     * @return array return is array of
40
-     *               [
41
-     *               [
42
-     *               '', // Git-ignore Pattern
43
-     *               [], // array of file paths matching
44
-     *               [], // array of file paths not matching
45
-     *               ],
46
-     *               ]
47
-     */
48
-    public function provider()
49
-    {
50
-        return [
51
-            [
52
-                '
53
-                    *
54
-                    !/bin/bash
55
-                ',
56
-                ['bin/cat', 'abc/bin/cat'],
57
-                ['bin/bash'],
58
-            ],
59
-            [
60
-                'fi#le.txt',
61
-                [],
62
-                ['#file.txt'],
63
-            ],
64
-            [
65
-                '
66
-                /bin/
67
-                /usr/local/
68
-                !/bin/bash
69
-                !/usr/local/bin/bash
70
-                ',
71
-                ['bin/cat'],
72
-                ['bin/bash'],
73
-            ],
74
-            [
75
-                '*.py[co]',
76
-                ['file.pyc', 'file.pyc'],
77
-                ['filexpyc', 'file.pycx', 'file.py'],
78
-            ],
79
-            [
80
-                'dir1/**/dir2/',
81
-                ['dir1/dirA/dir2/', 'dir1/dirA/dirB/dir2/'],
82
-                [],
83
-            ],
84
-            [
85
-                'dir1/*/dir2/',
86
-                ['dir1/dirA/dir2/'],
87
-                ['dir1/dirA/dirB/dir2/'],
88
-            ],
89
-            [
90
-                '/*.php',
91
-                ['file.php'],
92
-                ['app/file.php'],
93
-            ],
94
-            [
95
-                '\#file.txt',
96
-                ['#file.txt'],
97
-                [],
98
-            ],
99
-            [
100
-                '*.php',
101
-                ['app/file.php', 'file.php'],
102
-                ['file.phps', 'file.phps', 'filephps'],
103
-            ],
104
-            [
105
-                'app/cache/',
106
-                ['app/cache/file.txt', 'app/cache/dir1/dir2/file.txt', 'a/app/cache/file.txt'],
107
-                [],
108
-            ],
109
-            [
110
-                '
111
-                #IamComment
112
-                /app/cache/',
113
-                ['app/cache/file.txt', 'app/cache/subdir/ile.txt'],
114
-                ['a/app/cache/file.txt'],
115
-            ],
116
-        ];
117
-    }
118
-}
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,118 @@
1
+<?php
2
+/*
3
+ * This file is part of the Symfony package.
4
+ *
5
+ * (c) Fabien Potencier <fabien@symfony.com>
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+
11
+namespace Symfony\Component\Finder\Tests;
12
+
13
+use PHPUnit\Framework\TestCase;
14
+use Symfony\Component\Finder\Gitignore;
15
+
16
+class GitignoreTest extends TestCase
17
+{
18
+    /**
19
+     * @dataProvider provider
20
+     *
21
+     * @param string $patterns
22
+     * @param array  $matchingCases
23
+     * @param array  $nonMatchingCases
24
+     */
25
+    public function testCases(string $patterns, array $matchingCases, array $nonMatchingCases)
26
+    {
27
+        $regex = Gitignore::toRegex($patterns);
28
+
29
+        foreach ($matchingCases as $matchingCase) {
30
+            $this->assertRegExp($regex, $matchingCase, sprintf('Failed asserting path [%s] matches gitignore patterns [%s] using regex [%s]', $matchingCase, $patterns, $regex));
31
+        }
32
+
33
+        foreach ($nonMatchingCases as $nonMatchingCase) {
34
+            $this->assertNotRegExp($regex, $nonMatchingCase, sprintf('Failed asserting path [%s] not matching gitignore patterns [%s] using regex [%s]', $nonMatchingCase, $patterns, $regex));
35
+        }
36
+    }
37
+
38
+    /**
39
+     * @return array return is array of
40
+     *               [
41
+     *               [
42
+     *               '', // Git-ignore Pattern
43
+     *               [], // array of file paths matching
44
+     *               [], // array of file paths not matching
45
+     *               ],
46
+     *               ]
47
+     */
48
+    public function provider()
49
+    {
50
+        return [
51
+            [
52
+                '
53
+                    *
54
+                    !/bin/bash
55
+                ',
56
+                ['bin/cat', 'abc/bin/cat'],
57
+                ['bin/bash'],
58
+            ],
59
+            [
60
+                'fi#le.txt',
61
+                [],
62
+                ['#file.txt'],
63
+            ],
64
+            [
65
+                '
66
+                /bin/
67
+                /usr/local/
68
+                !/bin/bash
69
+                !/usr/local/bin/bash
70
+                ',
71
+                ['bin/cat'],
72
+                ['bin/bash'],
73
+            ],
74
+            [
75
+                '*.py[co]',
76
+                ['file.pyc', 'file.pyc'],
77
+                ['filexpyc', 'file.pycx', 'file.py'],
78
+            ],
79
+            [
80
+                'dir1/**/dir2/',
81
+                ['dir1/dirA/dir2/', 'dir1/dirA/dirB/dir2/'],
82
+                [],
83
+            ],
84
+            [
85
+                'dir1/*/dir2/',
86
+                ['dir1/dirA/dir2/'],
87
+                ['dir1/dirA/dirB/dir2/'],
88
+            ],
89
+            [
90
+                '/*.php',
91
+                ['file.php'],
92
+                ['app/file.php'],
93
+            ],
94
+            [
95
+                '\#file.txt',
96
+                ['#file.txt'],
97
+                [],
98
+            ],
99
+            [
100
+                '*.php',
101
+                ['app/file.php', 'file.php'],
102
+                ['file.phps', 'file.phps', 'filephps'],
103
+            ],
104
+            [
105
+                'app/cache/',
106
+                ['app/cache/file.txt', 'app/cache/dir1/dir2/file.txt', 'a/app/cache/file.txt'],
107
+                [],
108
+            ],
109
+            [
110
+                '
111
+                #IamComment
112
+                /app/cache/',
113
+                ['app/cache/file.txt', 'app/cache/subdir/ile.txt'],
114
+                ['a/app/cache/file.txt'],
115
+            ],
116
+        ];
117
+    }
118
+}