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

Public Member Functions

 testBlockPresentInHead ()
 
 testBlockIsAbsentInBody ()
 
 testBlockOutputIsEmptyWhenGaIsDisabled ()
 
 testBlockOutputExistsWhenGaIsEnabled ()
 
- Public Member Functions inherited from AbstractController
 getRequest ()
 
 getResponse ()
 
 assert404NotFound ()
 
 assertHeaderPcre ($headerName, $valueRegex)
 
 assertRedirect (\PHPUnit\Framework\Constraint\Constraint $urlConstraint=null)
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from AbstractController
 _getBootstrap ()
 
 setUp ()
 
 tearDown ()
 
 assertPostConditions ()
 
 getMessages ( $messageType=null, $messageManagerClass=\Magento\Framework\Message\Manager::class)
 

Additional Inherited Members

- Protected Attributes inherited from AbstractController
 $_runCode = ''
 
 $_runScope = 'store'
 
 $_runOptions = []
 
 $_request
 
 $_response
 
 $_objectManager
 
 $_assertSessionErrors = false
 

Detailed Description

Definition at line 13 of file GaTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 25 of file GaTest.php.

26  {
27  parent::setUp();
28  $this->dispatch('/');
29  $this->layout = $this->_objectManager->get(\Magento\Framework\View\LayoutInterface::class);
30  }

◆ testBlockIsAbsentInBody()

testBlockIsAbsentInBody ( )

Test that block has been successfully moved from body to head tag.

Definition at line 46 of file GaTest.php.

47  {
48  $this->assertFalse(
49  $this->getGaBlockFromNode('after.body.start')
50  );
51  }

◆ testBlockOutputExistsWhenGaIsEnabled()

testBlockOutputExistsWhenGaIsEnabled ( )

Check, that block successfully gets rendered when configuration is active.

@magentoAppArea frontend @magentoConfigFixture current_store google/analytics/active 1 @magentoConfigFixture current_store google/analytics/account XXXXXXX

Definition at line 76 of file GaTest.php.

77  {
78  $this->assertNotEquals(
79  "",
80  $this->getGaBlockFromNode('head.additional')->toHtml()
81  );
82  }

◆ testBlockOutputIsEmptyWhenGaIsDisabled()

testBlockOutputIsEmptyWhenGaIsDisabled ( )

Test null output when GA is disabled

@magentoAppArea frontend @magentoConfigFixture current_store google/analytics/active 0 @magentoConfigFixture current_store google/analytics/account XXXXXXX

Definition at line 60 of file GaTest.php.

61  {
62  $this->assertEquals(
63  "",
64  $this->getGaBlockFromNode('head.additional')->toHtml()
65  );
66  }

◆ testBlockPresentInHead()

testBlockPresentInHead ( )

Check for correct position of GA block

Definition at line 35 of file GaTest.php.

36  {
37  $this->assertNotNull(
38  $this->getGaBlockFromNode('head.additional')
39  );
40  }

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