Skip to content
This repository was archived by the owner on Jan 5, 2018. It is now read-only.

Commit 55cb38d

Browse files
author
Milos Dencev
committed
Fixed routing and added comments to test
1 parent fe5ca45 commit 55cb38d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

file_entity.routing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ file_entity.settings:
136136
_permission: 'administer files'
137137

138138
file_entity.file_add_archive_form:
139-
path: admin/content/files/archive
139+
path: /admin/content/files/archive
140140
defaults:
141141
_form: '\Drupal\file_entity\Form\FileAddArchiveForm'
142142
_title: 'Upload archive'

src/Tests/FileEntityCreationTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,21 @@ public function testArchiveUpload() {
169169
$this->assertText('Extracted archive.tar.gz and added 1 new files.');
170170

171171
// Files that match the pattern can be found in the database.
172-
$this->assertTrue($file = !empty($file_storage->loadByProperties(['filename' => 'test_jpg.jpg'])));
172+
$this->assertTrue($file = !empty($file_storage->loadByProperties(['filename' => 'test_jpg.jpg'])), "File that matches the pattern can be found in the database.");
173173
// Files that match the pattern should be permanent.
174-
$this->assertTrue($file ? $this->getFileByFilename('test_jpg.jpg')->isPermanent() : FALSE);
174+
$this->assertTrue($file ? $this->getFileByFilename('test_jpg.jpg')->isPermanent() : FALSE, "File that matches the pattern is permanent.");
175175
// Files that don't match the pattern are not in the database.
176-
$this->assertFalse(!empty($file_storage->loadByProperties(['filename' => 'test_png.png'])));
177-
$this->assertFalse(!empty($file_storage->loadByProperties(['filename' => 'test_text.txt'])));
176+
$this->assertFalse(!empty($file_storage->loadByProperties(['filename' => 'test_png.png'])), "File that doesn't match the pattern is not in the database.");
177+
$this->assertFalse(!empty($file_storage->loadByProperties(['filename' => 'test_text.txt'])), "File that doesn't match the pattern is not in the database.");
178178
// Archive is removed since we checked the remove_archive checkbox.
179-
$this->assertFalse(!empty($file_storage->loadByProperties(['filename' => 'archive.tar.gz'])));
179+
$this->assertFalse(!empty($file_storage->loadByProperties(['filename' => 'archive.tar.gz'])), "Archive is removed since we checked the remove_archive checkbox.");
180180

181181
$all_files = file_scan_directory('public://', '/.*/');
182182
// Only files that match the pattern are in the public directory.
183-
$this->assertTrue(array_key_exists('public://archive.tar/' . $jpg_file_path, $all_files));
184-
$this->assertFalse(array_key_exists('public://archive.tar/' . $png_file_path, $all_files));
185-
$this->assertFalse(array_key_exists('public://archive.tar/' . $text_file_path, $all_files));
186-
$this->assertFalse(array_key_exists('public://archive.tar.gz', $all_files));
183+
$this->assertTrue(array_key_exists('public://archive.tar/' . $jpg_file_path, $all_files), "File that matches the pattern is in the public directory.");
184+
$this->assertFalse(array_key_exists('public://archive.tar/' . $png_file_path, $all_files), "File that doesn't match the pattern is removed from the public directory.");
185+
$this->assertFalse(array_key_exists('public://archive.tar/' . $text_file_path, $all_files), "File that doesn't match the pattern is removed from the public directory.");
186+
$this->assertFalse(array_key_exists('public://archive.tar.gz', $all_files), "Archive is removed from the public directory since we checked the remove_archive checkbox.");
187187

188188
$archive_path = file_directory_temp() . '/archive2.tar.gz';
189189
$archiver = new Tar($archive_path);
@@ -197,12 +197,12 @@ public function testArchiveUpload() {
197197
$this->drupalPostForm(NULL, $edit, t('Submit'));
198198

199199
// Archive is in the database since value for remove_checkbox is FALSE.
200-
$this->assertTrue($file = !empty($file_storage->loadByProperties(['filename' => 'archive2.tar.gz'])));
200+
$this->assertTrue($file = !empty($file_storage->loadByProperties(['filename' => 'archive2.tar.gz'])), "Archive is in the database since value for remove_checkbox is FALSE.");
201201
// Check if the archive is set to permanent.
202-
$this->assertTrue($file ? $this->getFileByFilename('archive2.tar.gz')->isPermanent() : FALSE);
202+
$this->assertTrue($file ? $this->getFileByFilename('archive2.tar.gz')->isPermanent() : FALSE, "Archive is permanent since value for remove_checkbox is FALSE.");
203203

204204
$all_files = file_scan_directory('public://', '/.*/');
205-
$this->assertTrue(array_key_exists('public://archive2.tar.gz', $all_files));
205+
$this->assertTrue(array_key_exists('public://archive2.tar.gz', $all_files), "Archive is in the public directory since value for remove_checkbox is FALSE.");
206206
}
207207

208208
}

0 commit comments

Comments
 (0)