Exemplo n.º 1
0
 public function testBuildDeleteIndex()
 {
     $blueprint = new Blueprint('index');
     $blueprint->delete();
     $connection = Mockery::mock('Tamayo\\Stretchy\\Connection');
     $connection->shouldReceive('indexDelete')->once();
     $grammar = Mockery::mock('Tamayo\\Stretchy\\Index\\Grammar');
     $grammar->shouldReceive('compileIndexDelete')->once();
     $blueprint->build($connection, $grammar);
 }
Exemplo n.º 2
0
 public function testBasicCreateIndexWithPrefix()
 {
     $blueprint = new Blueprint('basic');
     $blueprint->create();
     $blueprint->shards(1);
     $blueprint->replicas(3);
     $grammar = $this->getGrammar();
     $grammar->setIndexPrefix('prefix_');
     $json = $blueprint->toJson($this->getConnection(), $grammar);
     $this->assertEquals('{"index":"prefix_basic","body":{"settings":{"number_of_shards":1,"number_of_replicas":3}}}', $json);
 }
Exemplo n.º 3
0
 /**
  * Execute the blueprint to build / modify the table.
  *
  * @param  \Tamayo\Stretch\Index\Blueprint $blueprint
  * @return void
  */
 protected function build(Blueprint $blueprint)
 {
     $blueprint->build($this->connection, $this->grammar);
 }
Exemplo n.º 4
0
 /**
  * Compile the replica count.
  *
  * @param  Blueprint $blueprint
  * @return array
  */
 public function compileReplicas(Blueprint $blueprint)
 {
     return $this->compile('number_of_replicas', $blueprint->getReplicas());
 }