Skip to content

Commit

Permalink
2907: #2907: Integration Test Annotation magentoAppArea breaks with s…
Browse files Browse the repository at this point in the history
…ome valid values
  • Loading branch information
nmalevanec committed Dec 12, 2017
1 parent 6b749c0 commit 7be1e58
Showing 1 changed file with 0 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Magento\Framework\App\State;
use Magento\Framework\Autoload\ClassLoaderWrapper;
use Magento\Framework\Config\Scope;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\Shell;
use Magento\TestFramework\Application;
Expand Down Expand Up @@ -83,73 +82,6 @@ public function testConstructor()
);
}

/**
* Test \Magento\TestFramework\Application will correctly load specified areas.
*/
public function testBackEndLoadArea()
{
$configScope = $this->getMockBuilder(Scope::class)->disableOriginalConstructor()->getMock();
$configScope->expects($this->once())->method('setCurrentScope')->with($this->identicalTo(Area::AREA_ADMINHTML));

$configLoader = $this->getMockBuilder(ConfigLoader::class)->disableOriginalConstructor()->getMock();
$configLoader->expects($this->once())
->method('load')
->with($this->identicalTo(Area::AREA_ADMINHTML))
->willReturn([]);
$areaList = $this->getMockBuilder(AreaList::class)->disableOriginalConstructor()->getMock();

/** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
$objectManager = $this->getMockBuilder(ObjectManagerInterface::class)->disableOriginalConstructor()->getMock();
$objectManager->expects($this->once())->method('configure')->with($this->identicalTo([]));
$objectManager->expects($this->exactly(3))
->method('get')
->willReturnOnConsecutiveCalls(
$configScope,
$configLoader,
$areaList
);

\Magento\TestFramework\Helper\Bootstrap::setObjectManager($objectManager);

$bootstrap = $this->getMockBuilder(\Magento\TestFramework\Helper\Bootstrap::class)
->disableOriginalConstructor()
->getMock();
$bootstrap->expects($this->once())->method('loadArea')->with($this->identicalTo(Area::AREA_ADMINHTML));
\Magento\TestFramework\Helper\Bootstrap::setInstance($bootstrap);

$this->subject->loadArea(Area::AREA_ADMINHTML);
}

/**
* Test \Magento\TestFramework\Application will correctly load specified areas.
*/
public function testFrontEndLoadArea()
{
$configScope = $this->getMockBuilder(Scope::class)->disableOriginalConstructor()->getMock();
$configScope->expects($this->once())->method('setCurrentScope')->with($this->identicalTo(Area::AREA_FRONTEND));

$configLoader = $this->getMockBuilder(ConfigLoader::class)->disableOriginalConstructor()->getMock();
$configLoader->expects($this->once())
->method('load')
->with($this->identicalTo(Area::AREA_FRONTEND))
->willReturn([]);
$areaList = $this->getMockBuilder(AreaList::class)->disableOriginalConstructor()->getMock();

/** @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject $objectManager */
$objectManager = $this->getMockBuilder(ObjectManagerInterface::class)->disableOriginalConstructor()->getMock();
$objectManager->expects($this->once())->method('configure')->with($this->identicalTo([]));
$objectManager->expects($this->exactly(3))
->method('get')
->willReturnOnConsecutiveCalls(
$configScope,
$configLoader,
$areaList
);

\Magento\TestFramework\Helper\Bootstrap::setObjectManager($objectManager);
$this->subject->loadArea(Area::AREA_FRONTEND);
}

/**
* Test \Magento\TestFramework\Application will correctly load specified areas.
*
Expand Down

0 comments on commit 7be1e58

Please sign in to comment.