diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-06-17 19:08:02 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 78657347c5b463d7c22bfc8c87b7db39fe058833 (patch) | |
tree | a61c513ce05a597119cb5e9e65a33a94e01663d9 /tests/netscape/BookmarkImportTest.php | |
parent | c70ff64a61d62cc8d35a62f30596ecc2a3c578a3 (diff) | |
download | Shaarli-78657347c5b463d7c22bfc8c87b7db39fe058833.tar.gz Shaarli-78657347c5b463d7c22bfc8c87b7db39fe058833.tar.zst Shaarli-78657347c5b463d7c22bfc8c87b7db39fe058833.zip |
Process bookmarks import through Slim controller
Diffstat (limited to 'tests/netscape/BookmarkImportTest.php')
-rw-r--r-- | tests/netscape/BookmarkImportTest.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/netscape/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php index 20b1c6f4..f678e26b 100644 --- a/tests/netscape/BookmarkImportTest.php +++ b/tests/netscape/BookmarkImportTest.php | |||
@@ -4,27 +4,28 @@ namespace Shaarli\Netscape; | |||
4 | 4 | ||
5 | use DateTime; | 5 | use DateTime; |
6 | use PHPUnit\Framework\TestCase; | 6 | use PHPUnit\Framework\TestCase; |
7 | use Psr\Http\Message\UploadedFileInterface; | ||
7 | use Shaarli\Bookmark\Bookmark; | 8 | use Shaarli\Bookmark\Bookmark; |
8 | use Shaarli\Bookmark\BookmarkFileService; | 9 | use Shaarli\Bookmark\BookmarkFileService; |
9 | use Shaarli\Bookmark\BookmarkFilter; | 10 | use Shaarli\Bookmark\BookmarkFilter; |
10 | use Shaarli\Config\ConfigManager; | 11 | use Shaarli\Config\ConfigManager; |
11 | use Shaarli\History; | 12 | use Shaarli\History; |
13 | use Slim\Http\UploadedFile; | ||
12 | 14 | ||
13 | /** | 15 | /** |
14 | * Utility function to load a file's metadata in a $_FILES-like array | 16 | * Utility function to load a file's metadata in a $_FILES-like array |
15 | * | 17 | * |
16 | * @param string $filename Basename of the file | 18 | * @param string $filename Basename of the file |
17 | * | 19 | * |
18 | * @return array A $_FILES-like array | 20 | * @return UploadedFileInterface Upload file in PSR-7 compatible object |
19 | */ | 21 | */ |
20 | function file2array($filename) | 22 | function file2array($filename) |
21 | { | 23 | { |
22 | return array( | 24 | return new UploadedFile( |
23 | 'filetoupload' => array( | 25 | __DIR__ . '/input/' . $filename, |
24 | 'name' => $filename, | 26 | $filename, |
25 | 'tmp_name' => __DIR__ . '/input/' . $filename, | 27 | null, |
26 | 'size' => filesize(__DIR__ . '/input/' . $filename) | 28 | filesize(__DIR__ . '/input/' . $filename) |
27 | ) | ||
28 | ); | 29 | ); |
29 | } | 30 | } |
30 | 31 | ||