@@ -91,7 +91,7 @@ protected function setUp()
91
91
*
92
92
* @return void
93
93
*/
94
- public function testDownload ()
94
+ public function testExecute (): void
95
95
{
96
96
$ fileName = 'customer.csv ' ;
97
97
$ path = 'export/ ' . $ fileName ;
@@ -102,48 +102,34 @@ public function testDownload()
102
102
$ response = $ this ->createMock (ResponseInterface::class);
103
103
$ this ->fileFactoryMock ->expects ($ this ->once ())
104
104
->method ('create ' )
105
- ->with ($ path , $ fileContent , DirectoryList::VAR_DIR )->willReturn ($ response );
105
+ ->with ($ path , $ fileContent , DirectoryList::VAR_DIR )
106
+ ->willReturn ($ response );
106
107
107
108
$ this ->controller ->execute ();
108
109
}
109
110
110
111
/**
111
112
* Check behavior with incorrect filename.
112
113
*
113
- * @param string $fileName
114
- * @dataProvider fileNameDataProvider
115
114
* @expectedException \Magento\Framework\Exception\LocalizedException
116
115
* @expectedExceptionMessage Please provide valid export file name
117
116
* @return void
118
117
*/
119
- public function testDownloadWithIncorrectFilename ( string $ fileName )
118
+ public function testExecuteWithEmptyFileName (): void
120
119
{
121
- $ this ->requestMock ->expects ($ this ->once ())->method ('getParam ' )->with ('filename ' )->willReturn ($ fileName );
120
+ $ this ->requestMock ->expects ($ this ->once ())->method ('getParam ' )->with ('filename ' )->willReturn ('' );
122
121
123
122
$ this ->controller ->execute ();
124
123
}
125
124
126
- /**
127
- * Data provider for testDownloadWithIncorrectFilename.
128
- *
129
- * @return array
130
- */
131
- public function fileNameDataProvider (): array
132
- {
133
- return [
134
- 'Empty parameter ' => ['' ],
135
- 'Incorrect Name ' => ['../customer.csv ' ],
136
- ];
137
- }
138
-
139
125
/**
140
126
* Check behavior when method throw exception.
141
127
*
142
128
* @expectedException \Magento\Framework\Exception\LocalizedException
143
- * @expectedExceptionMessage There are no export file with such name
129
+ * @expectedExceptionMessage There are no export file with such name customer.csv
144
130
* @return void
145
131
*/
146
- public function testDownloadWithException ()
132
+ public function testExecuteWithNonExistanceFile (): void
147
133
{
148
134
$ fileName = 'customer.csv ' ;
149
135
$ path = 'export/ ' . $ fileName ;
@@ -164,7 +150,7 @@ public function testDownloadWithException()
164
150
* @param string $path
165
151
* @return void
166
152
*/
167
- private function processDownloadAction (string $ fileName , string $ path )
153
+ private function processDownloadAction (string $ fileName , string $ path ): void
168
154
{
169
155
$ this ->requestMock ->expects ($ this ->once ())->method ('getParam ' )->with ('filename ' )->willReturn ($ fileName );
170
156
$ this ->fileSystemMock ->expects ($ this ->once ())
0 commit comments