Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AppIsolationTest.php
Go to the documentation of this file.
1 <?php
10 namespace Magento\Test\Annotation;
11 
12 class AppIsolationTest extends \PHPUnit\Framework\TestCase
13 {
17  protected $_object;
18 
22  protected $_application;
23 
24  protected function setUp()
25  {
26  $this->_application = $this->createPartialMock(\Magento\TestFramework\Application::class, ['reinitialize']);
27  $this->_object = new \Magento\TestFramework\Annotation\AppIsolation($this->_application);
28  }
29 
30  protected function tearDown()
31  {
32  $this->_application = null;
33  $this->_object = null;
34  }
35 
36  public function testStartTestSuite()
37  {
38  $this->_application->expects($this->once())->method('reinitialize');
39  $this->_object->startTestSuite();
40  }
41 
46  public function testEndTestIsolationInvalid()
47  {
48  $this->_object->endTest($this);
49  }
50 
57  {
58  $this->_object->endTest($this);
59  }
60 
61  public function testEndTestIsolationDefault()
62  {
63  $this->_application->expects($this->never())->method('reinitialize');
64  $this->_object->endTest($this);
65  }
66 
67  public function testEndTestIsolationController()
68  {
70  $controllerTest = $this->getMockForAbstractClass(\Magento\TestFramework\TestCase\AbstractController::class);
71  $this->_application->expects($this->once())->method('reinitialize');
72  $this->_object->endTest($controllerTest);
73  }
74 
78  public function testEndTestIsolationDisabled()
79  {
80  $this->_application->expects($this->never())->method('reinitialize');
81  $this->_object->endTest($this);
82  }
83 
87  public function testEndTestIsolationEnabled()
88  {
89  $this->_application->expects($this->once())->method('reinitialize');
90  $this->_object->endTest($this);
91  }
92 }