Exemplo n.º 1
0
    public function testGetDelayedAndFetchAllWithSelectInfo()
    {
        $items = array(
            'key1' => 'value1',
            'key2' => 'value2',
            'key3' => 'value3'
        );

        $this->assertSame(array(), $this->_storage->setItems($items));

        $capabilities = $this->_storage->getCapabilities();
        $this->assertTrue($this->_storage->getDelayed(array_keys($items), array(
            'select' => $capabilities->getSupportedMetadata()
        )));

        $fetchedItems = $this->_storage->fetchAll();

        $this->assertEquals(count($items), count($fetchedItems));
        foreach ($fetchedItems as $item) {
            if (is_array($capabilities->getSupportedMetadata())) {
                foreach ($capabilities->getSupportedMetadata() as $selectProperty) {
                    $this->assertArrayHasKey($selectProperty, $item);
                }
            }
        }
    }