Basho\Tests\SearchOperationsTest::testStoreIndex PHP Method

testStoreIndex() public method

public testStoreIndex ( )
    public function testStoreIndex()
    {
        $command = (new Command\Builder\Search\StoreIndex(static::$riak))->withName(static::INDEX)->usingSchema('_yz_default')->build();
        $response = $command->execute();
        $this->assertEquals('204', $response->getCode(), $response->getMessage());
        $command = (new Command\Builder\Search\FetchIndex(static::$riak))->withName(static::INDEX)->build();
        $response = $command->execute();
        // indexes take time to propagate between solr and Riak
        $attempts = 1;
        while ($response->getCode() != '200' || $attempts <= 5) {
            sleep(1);
            $response = $command->execute();
            $attempts++;
        }
        $this->assertEquals('200', $response->getCode(), $response->getMessage());
        $this->assertEquals(static::SCHEMA, $response->getIndex()->schema);
    }