1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-01-17 12:48:28 +01:00
php-zip/tests/ZipFinderTest.php

43 lines
907 B
PHP

<?php
namespace PhpZip\Tests;
use PhpZip\Constants\ZipCompressionMethod;
use PhpZip\Constants\ZipOptions;
use PhpZip\Exception\ZipException;
use PhpZip\ZipFile;
use Symfony\Component\Finder\Finder;
/**
* @internal
*
* @small
*/
class ZipFinderTest extends ZipTestCase
{
/**
* @throws ZipException
*/
public function testFinder()
{
$finder = (new Finder())
->files()
->name('*.php')
->in(__DIR__)
;
$zipFile = new ZipFile();
$zipFile->addFromFinder(
$finder,
[
ZipOptions::COMPRESSION_METHOD => ZipCompressionMethod::DEFLATED,
]
);
$zipFile->saveAsFile($this->outputFilename);
static::assertCorrectZipArchive($this->outputFilename);
static::assertSame($finder->count(), $zipFile->count());
$zipFile->close();
}
}