Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test for the compress.zlib://vfs:// functionality
The canOpenTwoCompressZlibUrlsAtTheSameTime() test currently fails, it seems it is not compatible with fopen(). This needs to be investigated while file_get|put_contents() works but not fopen().
- Loading branch information
mikey179
committed
Dec 17, 2015
1 parent
fc0d936
commit 116f535
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* This file is part of vfsStream. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package org\bovigo\vfs | ||
*/ | ||
namespace org\bovigo\vfs; | ||
/** | ||
* Test for stream_cast, e.g. compress.zlib://vfs://root/test.nbt. | ||
* | ||
* @group issue_125 | ||
*/ | ||
class StreamCastTestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @type \org\bovigo\vfs\vfsStreamDirectory | ||
*/ | ||
private $root; | ||
|
||
/** | ||
* set up test environment | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->root = vfsStream::setup('root'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function canUseCompressZlibInConjunctionWithVfsUrl() | ||
{ | ||
file_put_contents('compress.zlib://vfs://root/test.nbt', 'barbaz'); | ||
$this->assertEquals( | ||
'barbaz', | ||
file_get_contents('compress.zlib://vfs://root/test.nbt') | ||
); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function canOpenTwoCompressZlibUrlsAtTheSameTime() | ||
{ | ||
$file1 = fopen('compress.zlib://vfs://root/test.nbt', 'wb+'); | ||
$file2 = fopen('compress.zlib://vfs://root/other.nbt', 'wb+'); | ||
fwrite($file2, 'Yippie ki-yay'); | ||
fwrite($file1, 'barbaz'); | ||
fclose($file2); | ||
fclose($file1); | ||
$this->assertEquals( | ||
'barbaz', | ||
file_get_contents('compress.zlib://vfs://root/test.nbt') | ||
); | ||
$this->assertEquals( | ||
'Yippie ki-yay', | ||
file_get_contents('compress.zlib://vfs://root/other.nbt') | ||
); | ||
|
||
} | ||
} |