Commit df81a9d9 authored by Anton Smirnov's avatar Anton Smirnov
Browse files

Test with vfs stream

parent bdefe81c
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
        "ext-gmp": "*",
        "brick/math": "*",
        "dealerdirect/phpcodesniffer-composer-installer": "*",
        "mikey179/vfsstream": "^1.6",
        "pear/math_biginteger": "^1.0",
        "phpcompatibility/php-compatibility": "*",
        "phpunit/phpunit": ">=6.0.0 <10",
+5 −6
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ declare(strict_types=1);

namespace SandFox\Bencode\Tests;

use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\TestCase;
use SandFoxMe\Bencode\Bencode;
use SandFoxMe\Bencode\Exceptions\InvalidArgumentException;
@@ -62,13 +63,11 @@ class FileTest extends TestCase

    public function testInvalidFile()
    {
        $file = tempnam('/tmp', 'invalid');
        chmod($file, 0000);
        vfsStream::setup();
        $stream = vfsStream::newFile('test', 0000);

        @self::assertEquals(false, Bencode::dump($file, []));
        @self::assertEquals(false, Bencode::load($file));

        unlink($file);
        @self::assertEquals(false, Bencode::dump($stream->url(), []));
        @self::assertEquals(false, Bencode::load($stream->url()));
    }

    public function testEncodeToInvalidResource()