File tree 2 files changed +48
-1
lines changed
app/code/Magento/Ui/DataProvider/Config
dev/tests/unit/testsuite/Magento/Ui/DataProvider/Config 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function get($filename, $scope)
45
45
{
46
46
$ iterator = $ this ->iteratorFactory ->create (
47
47
$ this ->directoryRead ,
48
- $ this ->directoryRead ->search ('/*/*/etc/data_source/* ' )
48
+ $ this ->directoryRead ->search ('/*/*/etc/data_source/ ' . $ filename )
49
49
);
50
50
return $ iterator ;
51
51
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Magento \Ui \DataProvider \Config ;
4
+
5
+ use Magento \Framework \Filesystem ;
6
+ use Magento \Ui \DataProvider \Config \FileResolver ;
7
+ use Magento \Framework \Config \FileIteratorFactory ;
8
+
9
+ class FileResolverTest extends \PHPUnit_Framework_TestCase
10
+ {
11
+ /**
12
+ * @var \Magento\Framework\Filesystem\Directory\Read | \PHPUnit_Framework_MockObject_MockObject
13
+ */
14
+ private $ mockDirectoryRead ;
15
+
16
+ /**
17
+ * @var FileResolver
18
+ */
19
+ private $ fileResolver ;
20
+
21
+ public function setUp ()
22
+ {
23
+ $ this ->mockDirectoryRead = $ this ->getMockBuilder ('Magento\Framework\Filesystem\Directory\Read ' )
24
+ ->disableOriginalConstructor ()
25
+ ->getMock ();
26
+ $ stubFileIteratorFactory = $ this ->getMockBuilder ('Magento\Framework\Config\FileIteratorFactory ' )
27
+ ->disableOriginalConstructor ()
28
+ ->getMock ();
29
+ $ stubFilesystem = $ this ->getMockBuilder ('Magento\Framework\Filesystem ' )
30
+ ->disableOriginalConstructor ()
31
+ ->getMock ();
32
+ $ stubFilesystem ->expects ($ this ->any ())
33
+ ->method ('getDirectoryRead ' )
34
+ ->willReturn ($ this ->mockDirectoryRead );
35
+ $ this ->fileResolver = new FileResolver ($ stubFilesystem , $ stubFileIteratorFactory );
36
+ }
37
+
38
+ public function testItAppliesTheFilenamePattern ()
39
+ {
40
+ $ this ->mockDirectoryRead ->expects ($ this ->once ())
41
+ ->method ('search ' )
42
+ ->with ($ this ->matchesRegularExpression ('#\*\.xml$# ' ))
43
+ ->willReturn ([]);
44
+
45
+ $ this ->fileResolver ->get ('*.xml ' , '' );
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments