Code Duplication    Length = 21-22 lines in 2 locations

tests/php/AssetAdminTest.php 2 locations

@@ 191-211 (lines=21) @@
188
        $this->assertEquals('testItCreatesFile-v2.txt', $newFile2->Name);
189
    }
190
191
    public function testItRestrictsCreateFileOnCanCreate()
192
    {
193
        $folder = $this->objFromFixture(Folder::class, 'folder1');
194
195
        $fileData = array('Upload' => $this->getUploadFile('Upload', 'disallowCanCreate.txt'));
196
        $_FILES = $fileData;
197
        $response = Director::test(
198
            'admin/assets/api/createFile',
199
            array_merge(
200
                $fileData,
201
                [
202
                    'ParentID' => $folder->ID,
203
                    'SecurityID' => SecurityToken::inst()->getValue(),
204
                ]
205
            ),
206
            $this->session,
207
            'POST'
208
        );
209
        $this->assertTrue($response->isError());
210
        $this->assertEquals(403, $response->getStatusCode());
211
    }
212
213
    public function testItRestrictsCreateFileOnCanAddChildren()
214
    {
@@ 213-234 (lines=22) @@
210
        $this->assertEquals(403, $response->getStatusCode());
211
    }
212
213
    public function testItRestrictsCreateFileOnCanAddChildren()
214
    {
215
        $folder = $this->objFromFixture(Folder::class, 'disallowCanAddChildren');
216
217
        /** @skipUpgrade */
218
        $fileData = array('Upload' => $this->getUploadFile('Upload', 'test.txt'));
219
        $_FILES = $fileData;
220
        $response = Director::test(
221
            'admin/assets/api/createFile',
222
            array_merge(
223
                $fileData,
224
                [
225
                    'ParentID' => $folder->ID,
226
                    'SecurityID' => SecurityToken::inst()->getValue(),
227
                ]
228
            ),
229
            $this->session,
230
            'POST'
231
        );
232
        $this->assertTrue($response->isError());
233
        $this->assertEquals(403, $response->getStatusCode());
234
    }
235
236
    public function testItRestrictsCreateFileOnExtension()
237
    {