Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DbIsolationTest.php
Go to the documentation of this file.
1 <?php
7 
13 class DbIsolationTest extends \PHPUnit\Framework\TestCase
14 {
18  protected $_object;
19 
20  protected function setUp()
21  {
22  $this->_object = new \Magento\TestFramework\Annotation\DbIsolation();
23  }
24 
26  {
27  $eventParam = new \Magento\TestFramework\Event\Param\Transaction();
28  $this->_object->startTestTransactionRequest($this, $eventParam);
29  $this->assertTrue($eventParam->isTransactionStartRequested());
30  $this->assertFalse($eventParam->isTransactionRollbackRequested());
31 
32  $eventParam = new \Magento\TestFramework\Event\Param\Transaction();
33  $this->_object->startTransaction($this);
34  $this->_object->startTestTransactionRequest($this, $eventParam);
35  $this->assertFalse($eventParam->isTransactionStartRequested());
36  $this->assertFalse($eventParam->isTransactionRollbackRequested());
37  }
38 
43  {
45  }
46 
51  {
52  $eventParam = new \Magento\TestFramework\Event\Param\Transaction();
53  $this->_object->startTestTransactionRequest($this, $eventParam);
54  $this->assertFalse($eventParam->isTransactionStartRequested());
55  $this->assertFalse($eventParam->isTransactionRollbackRequested());
56 
57  $eventParam = new \Magento\TestFramework\Event\Param\Transaction();
58  $this->_object->startTransaction($this);
59  $this->_object->startTestTransactionRequest($this, $eventParam);
60  $this->assertFalse($eventParam->isTransactionStartRequested());
61  $this->assertTrue($eventParam->isTransactionRollbackRequested());
62  }
63 
69  {
70  $this->_object->startTestTransactionRequest($this, new \Magento\TestFramework\Event\Param\Transaction());
71  }
72 
79  {
80  $this->_object->startTestTransactionRequest($this, new \Magento\TestFramework\Event\Param\Transaction());
81  }
82 
87  {
88  $eventParam = new \Magento\TestFramework\Event\Param\Transaction();
89  $this->_object->endTestTransactionRequest($this, $eventParam);
90  $this->assertFalse($eventParam->isTransactionStartRequested());
91  $this->assertFalse($eventParam->isTransactionRollbackRequested());
92 
93  $eventParam = new \Magento\TestFramework\Event\Param\Transaction();
94  $this->_object->startTransaction($this);
95  $this->_object->endTestTransactionRequest($this, $eventParam);
96  $this->assertFalse($eventParam->isTransactionStartRequested());
97  $this->assertTrue($eventParam->isTransactionRollbackRequested());
98  }
99 }