示例#1
0
 public function setUp()
 {
     parent::setUp();
     if (!TestEntity::indexExists()) {
         TestEntity::createIndex();
     }
     TestEntity::flushEventListeners();
     TestEntity::boot();
     //run event listeners
     TestEntity::removeAllFromIndex();
 }
示例#2
0
 public function testEntitySearch()
 {
     TestEntity::removeAllFromIndex();
     $searchEntity = factory(TestEntity::class)->create(['varchar' => 'searchforthisstring']);
     sleep(1);
     //give the elastic search agent time to index
     $this->getJson('/test/entities/pages?q=searchforthisstring', ['Range' => 'entities=0-9']);
     $collection = json_decode($this->response->getContent());
     $this->assertResponseStatus(206);
     $this->shouldReturnJson();
     $this->assertJsonArray();
     $this->assertCount(1, $collection);
     $this->assertEquals($searchEntity->entity_id, $collection[0]->entityId);
 }