File: BzipTest.php

package info (click to toggle)
matomo-component-decompress 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 444 kB
  • sloc: php: 3,125; makefile: 25; xml: 21
file content (36 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL v3 or later
 */

namespace Tests\Matomo\Decompress;

use Matomo\Decompress\Bzip;

class BzipTest extends TestBase
{
    public function testBzipFile()
    {
        $extractFile = $this->tempDirectory . 'testbz.txt';

        $unzip = new Bzip($this->fixtureDirectory . '/test.bz2');
        $res = $unzip->extract($extractFile);
        $this->assertTrue($res);

        $this->assertFileContentsEquals('TESTSTRING', $extractFile);
    }

    public function testUnzipInvalidFile2()
    {
        $filename = $this->fixtureDirectory . '/NotExisting.zip';

        $unzip = new Bzip($filename);
        $res   = $unzip->extract($this->tempDirectory);
        $this->assertEquals(0, $res);

        $this->assertEquals('bzopen failed', $unzip->errorInfo());
    }
}