/**
  */
 public function test()
 {
     $users = $this->userProvider();
     foreach ($users as $dbEntity) {
         static::assertInstanceOf(GatewayUserPersist::class, $this->persist);
         $dbEntity['logintime'] = time();
         static::assertArrayHasKey('snsid', $dbEntity);
         $userObj = $this->factory->makeUser($dbEntity);
         //            dump($userObj);
         static::assertInstanceOf(User::class, $userObj);
         $userArr = $this->factory->toArray($userObj);
         //            dump($userArr);
         static::assertArrayHasKey('snsid', $userArr);
         $esIndex = Mockery::mock(Index::class);
         $esIndex->shouldReceive('addDocuments')->times(1)->andReturn(Mockery::mock(ResponseSet::class));
         $this->client->shouldReceive('getIndex')->times(1)->andReturn($esIndex);
         $success = $this->persist->persist([$userArr]);
         static::assertTrue($success);
         $this->persist->setSnsid($userObj->snsid);
         $esIndex = Mockery::mock(Index::class);
         $esType = Mockery::mock(\Elastica\Type::class);
         $document = Mockery::mock(Document::class);
         $document->shouldReceive('getData')->times(1)->andReturn($dbEntity);
         $esType->shouldReceive('getDocument')->times(1)->andReturn($document);
         $esIndex->shouldReceive('getType')->times(1)->andReturn($esType);
         $this->client->shouldReceive('getIndex')->times(1)->andReturn($esIndex);
         $found = $this->persist->retrieve();
         $foundObj = $this->factory->makeUser($found);
         static::assertEquals($userArr, $this->factory->toArray($foundObj));
     }
 }
 /**
  */
 public function testFire()
 {
     $userObjList = $this->userProvider();
     $userObj = array_pop($userObjList);
     static::assertInstanceOf(User::class, $userObj);
     $esIndex = Mockery::mock(Index::class);
     $esIndex->shouldReceive('addDocuments')->times(1)->andReturn(Mockery::mock(ResponseSet::class));
     $this->esClient->shouldReceive('getIndex')->times(1)->andReturn($esIndex);
     $this->userRepo->fire($userObj, $errorInfo);
     $this->assertNull($errorInfo);
     $this->userPersist->setSnsid($userObj->snsid);
     $esIndex = Mockery::mock(Index::class);
     $esType = Mockery::mock(\Elastica\Type::class);
     $document = Mockery::mock(Document::class);
     $document->shouldReceive('getData')->times(1)->andReturn((new Factory())->toArray($userObj));
     $esType->shouldReceive('getDocument')->times(1)->andReturn($document);
     $esIndex->shouldReceive('getType')->times(1)->andReturn($esType);
     $this->esClient->shouldReceive('getIndex')->times(1)->andReturn($esIndex);
     $found = $this->userPersist->retrieve();
     $foundObj = $this->factory->makeUser($found);
     static::assertEquals($this->factory->toArray($userObj), $this->factory->toArray($foundObj));
 }