Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
DocBlockTest Class Reference
Inheritance diagram for DocBlockTest:

Public Member Functions

 testRegisterAnnotations ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 _expectNoListenerCreation ($listenerClass, $expectedExceptionMsg)
 

Protected Attributes

 $_object
 
 $_application
 

Detailed Description

Definition at line 12 of file DocBlockTest.php.

Member Function Documentation

◆ _expectNoListenerCreation()

_expectNoListenerCreation (   $listenerClass,
  $expectedExceptionMsg 
)
protected

Setup expectation of inability to instantiate an event listener without passing the event manager instance

Parameters
string$listenerClass
string$expectedExceptionMsg

Definition at line 42 of file DocBlockTest.php.

43  {
44  try {
45  new $listenerClass();
46  $this->fail("Inability to instantiate the event listener '{$listenerClass}' is expected.");
47  } catch (\Magento\Framework\Exception\LocalizedException $e) {
48  $this->assertEquals($expectedExceptionMsg, $e->getMessage());
49  }
50  }

◆ setUp()

setUp ( )
protected

Definition at line 24 of file DocBlockTest.php.

25  {
26  $this->_object = new \Magento\TestFramework\Bootstrap\DocBlock(__DIR__);
27  $this->_application = $this->createMock(\Magento\TestFramework\Application::class);
28  }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ tearDown()

tearDown ( )
protected

Definition at line 30 of file DocBlockTest.php.

31  {
32  $this->_object = null;
33  $this->_application = null;
34  }

◆ testRegisterAnnotations()

testRegisterAnnotations ( )

Definition at line 52 of file DocBlockTest.php.

53  {
55  \Magento\TestFramework\Event\PhpUnit::class,
56  'Instance of the event manager is required.'
57  );
59  \Magento\TestFramework\Event\Magento::class,
60  'Instance of the "Magento\TestFramework\EventManager" is expected.'
61  );
62  $this->_object->registerAnnotations($this->_application);
63  new \Magento\TestFramework\Event\PhpUnit();
64  new \Magento\TestFramework\Event\Magento();
65  }
_expectNoListenerCreation($listenerClass, $expectedExceptionMsg)

Field Documentation

◆ $_application

$_application
protected

Definition at line 22 of file DocBlockTest.php.

◆ $_object

$_object
protected

Definition at line 17 of file DocBlockTest.php.


The documentation for this class was generated from the following file: