aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/netscape
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-06-17 19:08:02 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commit78657347c5b463d7c22bfc8c87b7db39fe058833 (patch)
treea61c513ce05a597119cb5e9e65a33a94e01663d9 /tests/netscape
parentc70ff64a61d62cc8d35a62f30596ecc2a3c578a3 (diff)
downloadShaarli-78657347c5b463d7c22bfc8c87b7db39fe058833.tar.gz
Shaarli-78657347c5b463d7c22bfc8c87b7db39fe058833.tar.zst
Shaarli-78657347c5b463d7c22bfc8c87b7db39fe058833.zip
Process bookmarks import through Slim controller
Diffstat (limited to 'tests/netscape')
-rw-r--r--tests/netscape/BookmarkImportTest.php15
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
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase; 6use PHPUnit\Framework\TestCase;
7use Psr\Http\Message\UploadedFileInterface;
7use Shaarli\Bookmark\Bookmark; 8use Shaarli\Bookmark\Bookmark;
8use Shaarli\Bookmark\BookmarkFileService; 9use Shaarli\Bookmark\BookmarkFileService;
9use Shaarli\Bookmark\BookmarkFilter; 10use Shaarli\Bookmark\BookmarkFilter;
10use Shaarli\Config\ConfigManager; 11use Shaarli\Config\ConfigManager;
11use Shaarli\History; 12use Shaarli\History;
13use 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 */
20function file2array($filename) 22function 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