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