public function testProgressActionWithSampleDataError() { $this->progressFactory->expects($this->once())->method('createFromLog') ->willThrowException($this->getMock('\Magento\Setup\SampleDataException')); $jsonModel = $this->controller->progressAction(); $this->assertInstanceOf('\Zend\View\Model\JsonModel', $jsonModel); $variables = $jsonModel->getVariables(); $this->assertArrayHasKey('success', $variables); $this->assertArrayHasKey('console', $variables); $this->assertFalse($variables['success']); $this->assertTrue($jsonModel->getVariable('isSampleDataError')); }
public function testProgressActionWithError() { $e = 'Some exception message'; $this->progressFactory->expects($this->once())->method('createFromLog')->will($this->throwException(new \LogicException($e))); $jsonModel = $this->controller->progressAction(); $this->assertInstanceOf('\\Zend\\View\\Model\\JsonModel', $jsonModel); $variables = $jsonModel->getVariables(); $this->assertArrayHasKey('success', $variables); $this->assertArrayHasKey('console', $variables); $this->assertFalse($variables['success']); $this->assertStringStartsWith('exception \'LogicException\' with message \'' . $e, $variables['console'][0]); }
public function testProgressActionNoInstallLogFile() { $this->webLogger->expects($this->once())->method('logfileExists')->willReturn(false); $jsonModel = $this->controller->progressAction(); $this->assertInstanceOf('\\Zend\\View\\Model\\JsonModel', $jsonModel); $variables = $jsonModel->getVariables(); $this->assertArrayHasKey('success', $variables); $this->assertArrayHasKey('console', $variables); $this->assertTrue($variables['success']); $this->assertEmpty($variables['console']); $this->assertSame(0, $variables['progress']); }
public function testProgressActionWithSampleDataError() { $numValue = 42; $progress = $this->getMock('\\Magento\\Setup\\Model\\Installer\\Progress', [], [], '', false); $progress->expects($this->once())->method('getRatio')->willReturn($numValue); $this->progressFactory->expects($this->once())->method('createFromLog')->willReturn($progress); $this->sampleDataState->expects($this->once())->method('hasError')->willReturn(true); $jsonModel = $this->controller->progressAction(); $this->assertInstanceOf('\\Zend\\View\\Model\\JsonModel', $jsonModel); $variables = $jsonModel->getVariables(); $this->assertArrayHasKey('success', $variables); $this->assertArrayHasKey('console', $variables); $this->assertTrue($variables['success']); $this->assertTrue($jsonModel->getVariable('isSampleDataError')); $this->assertSame(sprintf('%d', $numValue * 100), $variables['progress']); }