diff --git a/.gitignore b/.gitignore index fe53c7a..249199c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ vendor CHANGELOG-draft.md node_modules .phpunit.cache +docker-compose.yml diff --git a/composer.json b/composer.json index 8182fdf..13e8b82 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "kiwilan/php-ebook", "description": "PHP package to read metadata and extract covers from eBooks, comics and audiobooks.", - "version": "3.0.02", + "version": "3.0.03", "keywords": [ "php", "ebook", @@ -39,7 +39,7 @@ ], "require": { "php": "^8.1", - "kiwilan/php-archive": "^2.2.0", + "kiwilan/php-archive": "^2.3.01", "kiwilan/php-xml-reader": "^1.1.0" }, "require-dev": { diff --git a/tests/BookIdentifierTest.php b/tests/BookIdentifierTest.php index d2dce15..6d2242a 100644 --- a/tests/BookIdentifierTest.php +++ b/tests/BookIdentifierTest.php @@ -2,7 +2,7 @@ use Kiwilan\Ebook\Models\BookIdentifier; -it('can use BookIdentifier', function (string $value, string $scheme) { +it('can use book identifier', function (string $value, string $scheme) { $item = new BookIdentifier($value, $scheme); expect($item->getValue())->toBe($value); @@ -17,24 +17,24 @@ } })->with([ [ - 'content' => 'a2cf2f25-4de2-4f77-82cc-0198352b0851', - 'type' => 'uuid', + 'a2cf2f25-4de2-4f77-82cc-0198352b0851', + 'uuid', ], [ - 'content' => 'a2cf2f25-4de2-4f77-82cc-0198352b0851', - 'type' => 'uuid', + 'a2cf2f25-4de2-4f77-82cc-0198352b0851', + 'uuid', ], [ - 'content' => '63CTHAAACAAJ', - 'type' => 'google', + '63CTHAAACAAJ', + 'google', ], [ - 'content' => '2744155349', - 'type' => 'isbn10', + '2744155349', + 'isbn10', ], [ - 'content' => '9782266122122', - 'type' => 'isbn13', + '9782266122122', + 'isbn13', ], ]); @@ -45,51 +45,51 @@ expect($item->getScheme())->toBe($scheme); })->with([ [ - 'scheme' => 'isbn13', - 'value' => '9788075836663', + 'isbn13', + '9788075836663', ], [ - 'scheme' => 'qvn2sejbqufrqkfk', - 'value' => 'ASvHBAAAQBAJ', + 'qvn2sejbqufrqkfk', + 'ASvHBAAAQBAJ', ], [ - 'scheme' => 'uuid', - 'value' => 'urn:uuid:10225bf5-b0ec-43e7-910a-e0e208623cd9', + 'uuid', + 'urn:uuid:10225bf5-b0ec-43e7-910a-e0e208623cd9', ], [ - 'scheme' => 'uuid', - 'value' => '10225bf5-b0ec-43e7-910a-e0e208623cd9', + 'uuid', + '10225bf5-b0ec-43e7-910a-e0e208623cd9', ], [ - 'scheme' => 'custom', - 'value' => 'custom:customkey', + 'custom', + 'custom:customkey', ], [ - 'scheme' => 'doi', - 'value' => '10.1002/9781118257517', + 'doi', + '10.1002/9781118257517', ], [ - 'scheme' => 'y3vzdg9ta2v5', - 'value' => 'customkey', + 'y3vzdg9ta2v5', + 'customkey', ], ]); -it('can use without autoDetect', function (?string $scheme, ?string $value) { +it('can use without auto detect', function (?string $scheme, ?string $value) { $item = new BookIdentifier($value, $scheme, autoDetect: false); expect($item->getValue())->toBe($value); expect($item->getScheme())->toBe($scheme); })->with([ [ - 'scheme' => 'isbn13', - 'value' => '9788075836663', + 'isbn13', + '9788075836663', ], [ - 'scheme' => null, - 'value' => 'ASvHBAAAQBAJ', + null, + 'ASvHBAAAQBAJ', ], [ - 'scheme' => 'custom', - 'value' => null, + 'custom', + null, ], ]); diff --git a/tests/EntityTest.php b/tests/EntityTest.php index f51e061..750d540 100644 --- a/tests/EntityTest.php +++ b/tests/EntityTest.php @@ -6,7 +6,7 @@ use Kiwilan\Ebook\Models\BookIdentifier; use Kiwilan\Ebook\Models\BookMeta; -it('can use EbookEntity', function () { +it('can use ebook entity', function () { $ebook = Ebook::read(EPUB); $ebook->setTitle('title'); $ebook->setAuthors([ @@ -60,7 +60,7 @@ expect($ebook->__toString())->toBeString(); }); -it('can use BookContributor', function (string $content, string $role) { +it('can use book contributor', function (string $content, string $role) { $item = new BookContributor($content, $role); expect($item->getContents())->toBe($content); @@ -72,16 +72,16 @@ expect($item->__toString())->toBe($content); })->with([ [ - 'contents' => 'calibre', - 'role' => 'bkp', + 'calibre', + 'bkp', ], [ - 'contents' => 'epbu2', - 'role' => 'bkp', + 'epbu2', + 'bkp', ], ]); -it('can use BookAuthor', function (string $name, string $role) { +it('can use book author', function (string $name, string $role) { $item = new BookAuthor($name, $role); expect($item->getName())->toBe($name); @@ -93,16 +93,16 @@ expect($item->__toString())->toBe($name); })->with([ [ - 'contents' => 'Jean M. Auel', - 'role' => 'aut', + 'Jean M. Auel', + 'aut', ], [ - 'contents' => 'Terry Pratchett', - 'role' => 'aut', + 'Terry Pratchett', + 'aut', ], ]); -it('can use BookMeta', function (string $name, string $contents) { +it('can use book meta', function (string $name, string $contents) { $item = new BookMeta($name, $contents); expect($item->getName())->toBe($name); @@ -114,28 +114,28 @@ expect($item->__toString())->toBe("{$name} {$contents}"); })->with([ [ - 'name' => 'calibre:title_sort', - 'contents' => "clan de l'ours des cavernes, Le", + 'calibre:title_sort', + "clan de l'ours des cavernes, Le", ], [ - 'name' => 'calibre:series', - 'contents' => 'Les Enfants de la Terre', + 'calibre:series', + 'Les Enfants de la Terre', ], [ - 'name' => 'calibre:series_index', - 'contents' => '1.0', + 'calibre:series_index', + '1.0', ], [ - 'name' => 'calibre:timestamp', - 'contents' => '2023-03-25T10:32:21+00:00', + 'calibre:timestamp', + '2023-03-25T10:32:21+00:00', ], [ - 'name' => 'calibre:rating', - 'contents' => '10.0', + 'calibre:rating', + '10.0', ], ]); -it('can parse with BookMeta', function (mixed $data) { +it('can parse with book meta', function (mixed $data) { $meta = BookMeta::parse($data); expect($meta)->toBeString(); diff --git a/tests/PdfTest.php b/tests/PdfTest.php index a190b2b..405d956 100644 --- a/tests/PdfTest.php +++ b/tests/PdfTest.php @@ -31,7 +31,7 @@ expect(file_exists($path))->toBeTrue(); expect($path)->toBeReadableFile(); expect(fileIsValidImg($path))->toBeTrue(); -})->skip(PHP_OS_FAMILY === 'Windows' || PHP_VERSION >= '8.3', 'Skip on Windows or PHP >= 8.3'); +})->skip(PHP_OS_FAMILY === 'Windows', 'Skip on Windows or PHP >= 8.3'); it('can parse empty pdf', function () { $ebook = Ebook::read(PDF_EMPTY);