-
Notifications
You must be signed in to change notification settings - Fork 21
added tests for Jackalope fetch depth option #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<sv:node | ||
xmlns:mix="http://www.jcp.org/jcr/mix/1.0" | ||
xmlns:nt="http://www.jcp.org/jcr/nt/1.0" | ||
xmlns:jcr="http://www.jcp.org/jcr/1.0" | ||
xmlns:sv="http://www.jcp.org/jcr/sv/1.0" | ||
|
||
sv:name="tests_read_jackalope_fetch_depth"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
|
||
<sv:node sv:name="deepExample"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
|
||
<sv:node sv:name="deepExample"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
|
||
<sv:node sv:name="deepExample"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
|
||
<sv:node sv:name="deepExample"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
|
||
<sv:node sv:name="deepExample"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
</sv:node> | ||
|
||
</sv:node> | ||
</sv:node> | ||
</sv:node> | ||
</sv:node> | ||
</sv:node> |
This file contains hidden or 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,70 @@ | ||
<?php | ||
namespace PHPCR\Tests\Reading; | ||
|
||
require_once(__DIR__ . '/../../inc/BaseCase.php'); | ||
|
||
/** | ||
* functional tests for Jackalope fetch depth | ||
*/ | ||
class JackalopeFetchDepthTest extends \PHPCR\Test\BaseCase | ||
{ | ||
|
||
public static function setupBeforeClass($fixtures = '05_Reading/jackalopeFetchDepth') | ||
{ | ||
parent::setupBeforeClass($fixtures); | ||
} | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->renewSession(); | ||
} | ||
|
||
public function testGetNodeWithFetchDepth() | ||
{ | ||
if (!$this->session instanceof \Jackalope\Session) { | ||
return; | ||
} | ||
|
||
$node = $this->rootNode->getNode('tests_read_jackalope_fetch_depth'); | ||
|
||
$this->session->setSessionOption(\Jackalope\Session::OPTION_FETCH_DEPTH, 5); | ||
$deepExample = $node->getNode('deepExample'); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
|
||
$deepExample = $deepExample->getNode('deepExample'); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
|
||
$deepExample = $deepExample->getNode('deepExample'); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
|
||
$deepExample = $deepExample->getNode('deepExample'); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
} | ||
|
||
public function testGetNodesWithFetchDepth() | ||
{ | ||
if (!$this->session instanceof \Jackalope\Session) { | ||
return; | ||
} | ||
|
||
$node = $this->rootNode->getNode('tests_read_jackalope_fetch_depth'); | ||
|
||
$this->session->setSessionOption(\Jackalope\Session::OPTION_FETCH_DEPTH, 5); | ||
$deepExamples = $node->getNodes('deepExample'); | ||
$deepExample = $deepExamples->current(); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
|
||
$deepExamples = $node->getNodes('deepExample'); | ||
$deepExample = $deepExamples->current(); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
|
||
$deepExamples = $node->getNodes('deepExample'); | ||
$deepExample = $deepExamples->current(); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
|
||
$deepExamples = $node->getNodes('deepExample'); | ||
$deepExample = $deepExamples->current(); | ||
$this->assertEquals(array('deepExample'), (array) $deepExample->getNodeNames()); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this causes an infinite recursion on Jackalope Doctrine DBAL, note this happens on master as well as with jackalope/jackalope-doctrine-dbal#196
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbu the following change makes the tests pass:
not sure yet how they can cause the infinite recursion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah maybe because of the fetch depth?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the following patches fix the issue .. but I feel a bit like I am stabbing in the dark. what is especially strange is that jackrabbit doesn't even pass the while look that I am fixing in jackalope:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the objectmanager code looks cryptic indeed. the non-saved move operations complicate everything :-(
but i think your change is right,
$parent = PathHelper::getParentPath($fetchPath);
will work only for one level but then keep doing the same thing, where it is supposed to walk up the tree.for the transport, not sure what this is about (maybe the TODO is related?) . why would the type ever be null, is that sane?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok .. i will push the jackalope change into a PR
for the type .. let me investigate the case when this happens .. might be an issue in our fixtures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jackalope/jackalope#215
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the issue is that we are apparently one level too deep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see https://github.com/jackalope/jackalope-doctrine-dbal/pull/196/files#diff-a3a0165ed79ca1ba3513ec5ecd59ec56R210