@@ -51,6 +51,60 @@ public function testSearchClearUnknownIndex(): void
51
51
$ this ->assertStringContainsString ('Cannot clear index. Not found. ' , $ output );
52
52
}
53
53
54
+ public function testSearchImportAndClearWithoutIndices (): void
55
+ {
56
+ for ($ i = 0 ; $ i <= 5 ; ++$ i ) {
57
+ $ this ->createPost ();
58
+ }
59
+
60
+ for ($ i = 0 ; $ i <= 5 ; ++$ i ) {
61
+ $ this ->createTag (['id ' => $ i ]);
62
+ }
63
+
64
+ $ importCommand = $ this ->application ->find ('meili:import ' );
65
+ $ importCommandTester = new CommandTester ($ importCommand );
66
+ $ importCommandTester ->execute ([]);
67
+
68
+ $ importOutput = $ importCommandTester ->getDisplay ();
69
+
70
+ $ this ->assertSame (<<<'EOD'
71
+ Importing for index MeiliSearch\Bundle\Test\Entity\Post
72
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Post entities into sf_phpunit__posts index
73
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Post entities into sf_phpunit__aggregated index
74
+ Settings updated.
75
+ Settings updated.
76
+ Importing for index MeiliSearch\Bundle\Test\Entity\Comment
77
+ Importing for index MeiliSearch\Bundle\Test\Entity\Tag
78
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Tag entities into sf_phpunit__tags index
79
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Tag entities into sf_phpunit__aggregated index
80
+ Importing for index MeiliSearch\Bundle\Test\Entity\Link
81
+ Importing for index MeiliSearch\Bundle\Test\Entity\Post
82
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Post entities into sf_phpunit__posts index
83
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Post entities into sf_phpunit__aggregated index
84
+ Importing for index MeiliSearch\Bundle\Test\Entity\Tag
85
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Tag entities into sf_phpunit__tags index
86
+ Indexed 6 / 6 MeiliSearch\Bundle\Test\Entity\Tag entities into sf_phpunit__aggregated index
87
+ Done!
88
+
89
+ EOD, $ importOutput );
90
+
91
+ $ clearCommand = $ this ->application ->find ('meili:clear ' );
92
+ $ clearCommandTester = new CommandTester ($ clearCommand );
93
+ $ clearCommandTester ->execute ([]);
94
+
95
+ $ clearOutput = $ clearCommandTester ->getDisplay ();
96
+
97
+ $ this ->assertSame (<<<'EOD'
98
+ Cleared sf_phpunit__posts index of MeiliSearch\Bundle\Test\Entity\Post
99
+ Cleared sf_phpunit__comments index of MeiliSearch\Bundle\Test\Entity\Comment
100
+ Cleared sf_phpunit__aggregated index of MeiliSearch\Bundle\Test\Entity\ContentAggregator
101
+ Cleared sf_phpunit__tags index of MeiliSearch\Bundle\Test\Entity\Tag
102
+ Cleared sf_phpunit__tags index of MeiliSearch\Bundle\Test\Entity\Link
103
+ Done!
104
+
105
+ EOD, $ clearOutput );
106
+ }
107
+
54
108
/**
55
109
* Importing 'Tag' and 'Link' into the same 'tags' index.
56
110
*/
0 commit comments