Skip to content

Commit

Permalink
Merge pull request #45 from kiwilan/develop
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
ewilan-riviere authored Mar 8, 2024
2 parents 0861f86 + 464f6b4 commit 90a21d1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/run-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ jobs:
scoop update
scoop install 7zip
scoop install imagemagick ghostscript ffmpeg
scoop install which
scoop checkup
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
which 7z
shell: powershell

- name: Checkout code
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ Supports Linux, macOS and Windows.
- [`imagick`](https://www.php.net/manual/en/book.imagick.php) (optional) for `.PDF`
- [`bz2`](https://www.php.net/manual/en/book.bzip2.php) (optional) for `.BZ2` archives

| Type | Supported | Requirement | Uses |
| :-----------------------: | :-------: | :------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------: |
| `.zip`, `.epub`, `.cbz` || N/A | Uses [`zip` extension](https://www.php.net/manual/en/book.zip.php) |
| `.tar`, `.tar.gz`, `.cbt` || N/A | Uses [`phar` extension](https://www.php.net/manual/en/book.phar.php) |
| `.rar`, `.cbr` || [`rar` PHP extension](https://github.com/cataphract/php-rar) or [`p7zip`](https://www.7-zip.org/) binary | PHP `rar` or `p7zip` |
| `.7z`, `.cb7` || [`p7zip`](https://www.7-zip.org/) binary | `p7zip` binary |
| `.pdf` || Optional (for extraction) [`imagick` PHP extension](https://github.com/Imagick/imagick) | `smalot/pdfparser` |
| Type | Supported | Requirement | Uses |
| :-----------------------: | :-------: | :------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------: |
| `.zip`, `.epub`, `.cbz` || N/A | Uses [`zip` extension](https://www.php.net/manual/en/book.zip.php) |
| `.tar`, `.tar.gz`, `.cbt` || N/A | Uses [`phar` extension](https://www.php.net/manual/en/book.phar.php)\* |
| `.rar`, `.cbr` || [`rar` PHP extension](https://github.com/cataphract/php-rar) or [`p7zip`](https://www.7-zip.org/) binary | PHP `rar` or `p7zip` |
| `.7z`, `.cb7` || [`p7zip`](https://www.7-zip.org/) binary | `p7zip` binary |
| `.pdf` || Optional (for extraction) [`imagick` PHP extension](https://github.com/Imagick/imagick) | [`smalot/pdfparser`](https://github.com/smalot/pdfparser) |

\*: for `.tar` archives with password, `.7z` will be used because extension don't support password.

> [!NOTE]
>
Expand All @@ -54,6 +56,7 @@ If you want more information, you can read section [**About**](#about).

- List files as `ArchiveItem` array
- With `getFileItems()` method: list of files
- With `getFileItem(string $path)` method: file corresponding to `path` property
- With `getFirst()` method: first file
- With `getLast()` method: last file
- With `find()` method: find first file that match with `path` property
Expand Down Expand Up @@ -274,7 +277,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re

## Credits

- [Kiwilan](https://github.com/kiwilan)
- [Ewilan Riviere](https://github.com/ewilan-riviere)
- [All Contributors](../../contributors)
- [spatie](https://github.com/spatie) for `spatie/package-skeleton-php` and `spatie/temporary-directory`
- [`smalot/pdfparser`](https://github.com/smalot/pdfparser) for PDF parser
Expand Down
4 changes: 3 additions & 1 deletion tests/ArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ function (Pest\Expectation $item) use ($ext) {
if (PHP_OS_FAMILY === 'Windows') {
$current_user = exec('echo %USERNAME%');
$binary_path = "C:\\Users\\{$current_user}\\scoop\\apps\\7zip\\current\\7z.exe";
} else {
} elseif (PHP_OS_FAMILY === 'Darwin') {
$binary_path = '/opt/homebrew/bin/7z';
} else {
$binary_path = '/usr/bin/7z';
}
$archive = Archive::read($path)->overrideBinaryPath($binary_path);

Expand Down
2 changes: 1 addition & 1 deletion tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

expect($content)->toBeString();
expect($file)->toBeReadableFile();
});
})->skip(PHP_OS_FAMILY === 'Windows', 'Skip on Windows');

it('can extract some files', function () {
$archive = Archive::read(PDF);
Expand Down

0 comments on commit 90a21d1

Please sign in to comment.