@@ -85,37 +85,37 @@ public function testIndexImport(int $bulkSize, int $realSize, string $filename)
8585 *
8686 * @dataProvider compressedDataProvider
8787 */
88- // public function testIndexImportWithGzipOption($bulkSize, $realSize, $filename)
89- // {
90- // $index = $this->getIndex(DummyDocument::class);
91- //
92- // $app = new Application();
93- // $app->add($this->getImportCommand());
94- //
95- // $command = $app->find('ongr:es:index:import');
96- // $commandTester = new CommandTester($command);
97- // $commandTester->execute(
98- // [
99- // 'command' => $command->getName(),
100- // 'filename' => __DIR__ . '/../../app/data_seed/' . $filename,
101- // '--bulk-size' => $bulkSize,
102- // '--gzip' => null,
103- // ]
104- // );
105- //
106- //
107- // $search = $index->createSearch()->addQuery(new MatchAllQuery())->setSize($realSize);
108- // $results = $index->findDocuments($search);
109- //
110- // $ids = [];
111- // /** @var DummyDocument $doc */
112- // foreach ($results as $doc) {
113- // $ids[] = (int)$doc->id;
114- // }
115- // sort($ids);
116- // $data = range(1, $realSize);
117- // $this->assertEquals($data, $ids);
118- // }
88+ public function testIndexImportWithGzipOption ($ bulkSize , $ realSize , $ filename )
89+ {
90+ $ index = $ this ->getIndex (DummyDocument::class);
91+
92+ $ app = new Application ();
93+ $ app ->add ($ this ->getImportCommand ());
94+
95+ $ command = $ app ->find ('ongr:es:index:import ' );
96+ $ commandTester = new CommandTester ($ command );
97+ $ commandTester ->execute (
98+ [
99+ 'command ' => $ command ->getName (),
100+ 'filename ' => __DIR__ . '/../../app/data_seed/ ' . $ filename ,
101+ '--bulk-size ' => $ bulkSize ,
102+ '--gzip ' => null ,
103+ ]
104+ );
105+
106+
107+ $ search = $ index ->createSearch ()->addQuery (new MatchAllQuery ())->setSize ($ realSize );
108+ $ results = $ index ->findDocuments ($ search );
109+
110+ $ ids = [];
111+ /** @var DummyDocument $doc */
112+ foreach ($ results as $ doc ) {
113+ $ ids [] = (int )$ doc ->id ;
114+ }
115+ sort ($ ids );
116+ $ data = range (1 , $ realSize );
117+ $ this ->assertEquals ($ data , $ ids );
118+ }
119119
120120 /**
121121 * Returns import index command with assigned container.
0 commit comments