@@ 96-114 (lines=19) @@ | ||
93 | * |
|
94 | * @return void |
|
95 | */ |
|
96 | public function testExecuteWithIndexProvidedAndWithAlias() |
|
97 | { |
|
98 | $input = $this->getMockForAbstractClass('\Symfony\Component\Console\Input\InputInterface'); |
|
99 | $output = $this->getMockForAbstractClass('\Symfony\Component\Console\Output\OutputInterface'); |
|
100 | ||
101 | $indexName = 'foo'; |
|
102 | $mapping = ['mapping']; |
|
103 | ||
104 | $input->expects($this->once())->method('getOption')->with('index')->willReturn($indexName); |
|
105 | $output->expects($this->once())->method('writeln'); |
|
106 | $this->configManager->expects($this->once())->method('getIndexConfiguration')->with($indexName)->willReturn($this->indexConfig); |
|
107 | $this->indexManager->expects($this->once())->method('getIndex')->with($indexName)->willReturn($this->index); |
|
108 | $this->indexConfig->expects($this->once())->method('isUseAlias')->willReturn(true); |
|
109 | $this->aliasProcessor->expects($this->once())->method('setRootName')->with($this->indexConfig, $this->index); |
|
110 | $this->mappingBuilder->expects($this->once())->method('buildIndexMapping')->with($this->indexConfig)->willReturn($mapping); |
|
111 | $this->index->expects($this->once())->method('create')->with(['mapping'], false); |
|
112 | ||
113 | $this->command->run($input, $output); |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * Test execute with index provided and without alias. |
|
@@ 121-139 (lines=19) @@ | ||
118 | * |
|
119 | * @return void |
|
120 | */ |
|
121 | public function testExecuteWithIndexProvidedAndWithoutAlias() |
|
122 | { |
|
123 | $input = $this->getMockForAbstractClass('\Symfony\Component\Console\Input\InputInterface'); |
|
124 | $output = $this->getMockForAbstractClass('\Symfony\Component\Console\Output\OutputInterface'); |
|
125 | ||
126 | $indexName = 'foo'; |
|
127 | $mapping = ['mapping']; |
|
128 | ||
129 | $input->expects($this->once())->method('getOption')->with('index')->willReturn($indexName); |
|
130 | $output->expects($this->once())->method('writeln'); |
|
131 | $this->configManager->expects($this->once())->method('getIndexConfiguration')->with($indexName)->willReturn($this->indexConfig); |
|
132 | $this->indexManager->expects($this->once())->method('getIndex')->with($indexName)->willReturn($this->index); |
|
133 | $this->indexConfig->expects($this->once())->method('isUseAlias')->willReturn(false); |
|
134 | $this->aliasProcessor->expects($this->never())->method('setRootName'); |
|
135 | $this->mappingBuilder->expects($this->once())->method('buildIndexMapping')->with($this->indexConfig)->willReturn($mapping); |
|
136 | $this->index->expects($this->once())->method('create')->with(['mapping'], false); |
|
137 | ||
138 | $this->command->run($input, $output); |
|
139 | } |
|
140 | ||
141 | public function testExecuteAllIndices() |
|
142 | { |