public function testItDisplaysTheStatusForAllMatchingProducts() { $this->mockInput->method('getArgument')->with('sku')->willReturn('TEST'); $this->mockProductStatusAdapter->method('getProductStatusMatchingSku')->willReturn(['TEST1' => ProductStatusAdapterInterface::ENABLED, 'TEST2' => ProductStatusAdapterInterface::DISABLED, 'TEST3' => ProductStatusAdapterInterface::ENABLED]); $this->mockOutput->method('writeln')->withConsecutive(['<info>TEST1: enabled</info>'], ['<info>TEST2: disabled</info>'], ['<info>TEST3: enabled</info>']); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItDisplaysAConfirmationMessageIfThereWasNoException() { $expectedMessage = 'Status of product "test": ' . ProductStatusAdapterInterface::DISABLED; $this->mockOutput->expects($this->once())->method('writeln')->with($this->stringStartsWith('<info>' . $expectedMessage)); $this->mockInput->method('getArgument')->willReturn('test'); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItDisplaysAConfirmationMessage() { $expectedMessage = 'Status of product "test": enabled'; $this->mockOutput->expects($this->once())->method('writeln')->with('<info>' . $expectedMessage . '</info>'); $this->mockInput->method('getArgument')->willReturn('test'); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItDisplaysAMessageIfNoProductsMatchedTheGivenSku() { $expectedMessage = 'No products matching "test" found'; $this->mockInput->method('getArgument')->willReturn('test'); $this->mockProductStatusAdapter->method('getStatusForProductsMatchingSku')->willReturn([]); $this->mockOutput->expects($this->once())->method('writeln')->with($this->stringStartsWith('<comment>' . $expectedMessage)); $this->command->run($this->mockInput, $this->mockOutput); }