-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure url encoded pathes are handled correct, fixes #104
- Loading branch information
mikey179
committed
Mar 29, 2015
1 parent
c775dfd
commit 03a3899
Showing
3 changed files
with
53 additions
and
1 deletion.
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
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
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,51 @@ | ||
<?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; | ||
/** | ||
* @group issue_104 | ||
*/ | ||
class Issue104TestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function vfsStreamCanHandleUrlEncodedPathPassedByInternalPhpCode() | ||
{ | ||
$structure = array('foo bar' => array( | ||
'schema.xsd' => '<xs:schema targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<xs:complexType name="myType"></xs:complexType> | ||
</xs:schema>', | ||
) | ||
); | ||
vfsStream::setup('root', null, $structure); | ||
$doc = new \DOMDocument(); | ||
$this->assertTrue($doc->load(vfsStream::url('root/foo bar/schema.xsd'))); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function vfsStreamCanHandleUrlEncodedPath() | ||
{ | ||
$content = '<xs:schema targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
<xs:complexType name="myType"></xs:complexType> | ||
</xs:schema>'; | ||
$structure = array('foo bar' => array( | ||
'schema.xsd' => $content, | ||
) | ||
); | ||
vfsStream::setup('root', null, $structure); | ||
$this->assertEquals( | ||
$content, | ||
file_get_contents(vfsStream::url('root/foo%20bar/schema.xsd')) | ||
); | ||
} | ||
} | ||
|