Skip to content

seekable test #141

@dantleech

Description

@dantleech

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions