Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored methods from ObjectManager to Helper
extracted normalizing from ObjectManager::absolutePath into Helper::normalizePath and moved ::absolutePath to Helper:: changed Node::getNode to throw PHPCR_PathNotFoundException instead of PHPCR_ItemNotFoundException. fixed Property::checkMultiple exception instantiation. verify path absoluteness and well-formedness in Session::nodeExists and Session::propertyExists directly.
- Loading branch information
Showing
8 changed files
with
175 additions
and
73 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
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
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
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,36 @@ | ||
<?php | ||
require_once dirname(__FILE__) . '/../../src/jackalope/Helper.php'; | ||
require_once 'PHPUnit/Framework.php'; | ||
|
||
class jackalope_tests_Helper extends PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @dataProvider dataproviderAbsolutePath | ||
* @covers jackalope_Helper::absolutePath | ||
* @covers jackalope_Helper::normalizePath | ||
*/ | ||
public function testAbsolutePath($inputRoot, $inputRelPath, $output) { | ||
$this->assertEquals($output, jackalope_Helper::absolutePath($inputRoot, $inputRelPath)); | ||
} | ||
|
||
public static function dataproviderAbsolutePath() { | ||
return array( | ||
array('/', 'foo', '/foo'), | ||
array('/', '/foo', '/foo'), | ||
array('', 'foo', '/foo'), | ||
array('', '/foo', '/foo'), | ||
array('/foo', 'bar', '/foo/bar'), | ||
array('/foo', '', '/foo'), | ||
array('/foo/', 'bar', '/foo/bar'), | ||
array('/foo/', '/bar', '/foo/bar'), | ||
array('foo', 'bar', '/foo/bar'), | ||
|
||
// normalization is also part of ::absolutePath | ||
array('/', '../foo', '/foo'), | ||
array('/', 'foo/../bar', '/bar'), | ||
array('/', 'foo/./bar', '/foo/bar'), | ||
array('/foo/nope', '../bar', '/foo/bar'), | ||
array('/foo/nope', '/../bar', '/foo/bar'), | ||
); | ||
} | ||
} |