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 testItDisplaysExceptionsAsErrors() { $testMessage = 'Dummy Exception'; $this->mockInput->method('getArgument')->with('sku')->willReturn('test'); $this->mockProductStatusAdapter->method('enableProductWithSku')->willThrowException(new ProductStatusAdapterException($testMessage)); $this->mockOutput->expects($this->once())->method('writeln')->with('<error>' . $testMessage . '</error>'); $this->command->run($this->mockInput, $this->mockOutput); }
public function testItHidesProductAlreadyEnabledExceptions() { $this->mockProductStatusAdapter->method('enableProductWithSku')->willThrowException(new ProductAlreadyEnabledException('Dummy Exception')); $this->assertNotNull($this->api->set('test', 'enabled')); }