Skip to content

seekable test #141

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
dantleech opened this issue Oct 16, 2014 · 1 comment
Open

seekable test #141

dantleech opened this issue Oct 16, 2014 · 1 comment

Comments

@dantleech
Copy link
Member

The API tests tests with an integer:

    public function testSeekable()
    {
        $seekPosition = 2;

        $nodes = array();
        $i = 0;
        foreach ($this->nodeIterator as $path => $node) {
            if ($i++ == $seekPosition) {
                $seekNode = $node;
                $seekKey = $path;
            }
        }

        // note that in php 5.3.3, the array iterator gets the seek wrong and wants a string position instead of a number. according to the doc, we test for the correct behaviour here.
        $this->nodeIterator->seek($seekPosition);
        $this->assertEquals($seekKey, $this->nodeIterator->key());
        $this->assertEquals($seekNode, $this->nodeIterator->current());
    }

in jackalope:

    public function seek($nodeName)
    {
        foreach ($this->rows as $position => $columns) {
            foreach ($columns as $column) {
                if ($column['dcr:name'] == 'jcr:path') {
                    if ($column['dcr:value'] == $nodeName) {
                        $this->position = $position;

                        return;
                    }
                }
            }
        }

        throw new OutOfBoundsException("invalid seek position ($nodeName)");
    }

i.e. the API tests test with an integer, but jackalope expects a nodeName.

Doctrine DBAL skips this test:

                    // this seems a bug in php with arrayiterator - and jackalope is using
                    // arrayiterator for the search result
                    // TODO https://github.com/phpcr/phpcr-api-tests/issues/22
                    'Query\\NodeViewTest::testSeekable',

That issue has however been closed.

@dbu
Copy link
Member

dbu commented Oct 20, 2014

oh, indeed. yeah i think the reporter closed it when there was no more error showing in the tests.

did you check php 5.4 or newer, was this fixed?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants