public function testItDisplaysExceptionsAsErrorMessages() { $expectedMessage = 'Dummy Exception'; $this->mockProductStatusAdapter->method('disableProductWithSku')->willThrowException(new \Exception($expectedMessage)); $this->mockOutput->expects($this->once())->method('writeln')->with($this->stringStartsWith('<error>' . $expectedMessage)); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItDisplaysExceptionsAsAnErrorMessage() { $expectedMessage = 'Dummy Exception'; $this->mockOutput->expects($this->once())->method('writeln')->with('<error>' . $expectedMessage . '</error>'); $this->mockProductStatusAdapter->method('enableProductWithSku')->willThrowException(new \Exception($expectedMessage)); $this->mockInput->method('getArgument')->willReturn('test'); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItDisplaysTheStatusForAllReturnedProducts() { $this->mockProductStatusAdapter->method('getStatusForProductsMatchingSku')->willReturn(['test1' => ProductStatusAdapterInterface::ENABLED, 'test2' => ProductStatusAdapterInterface::DISABLED]); $this->mockOutput->expects($this->exactly(2))->method('writeln')->withConsecutive([$this->stringContains('Status of product "test1": ' . ProductStatusAdapterInterface::ENABLED)], [$this->stringContains('Status of product "test2": ' . ProductStatusAdapterInterface::DISABLED)]); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItPassesOnTheStatusReturnedByTheProductStatusAdapter() { $this->mockProductStatusAdapter->method('getStatusBySku')->willReturn(ProductStatusAdapterInterface::ENABLED); $this->assertSame(ProductStatusAdapterInterface::ENABLED, $this->statusManagement->get('test')); }