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

Public Member Functions

 testViewAction ()
 
 testViewRedirectWithTrailingSlash ()
 
 testAddBreadcrumbs ()
 
 testCreatePageWithSameModuleName ()
 
- Public Member Functions inherited from AbstractController
 getRequest ()
 
 getResponse ()
 
 assert404NotFound ()
 
 assertHeaderPcre ($headerName, $valueRegex)
 
 assertRedirect (\PHPUnit\Framework\Constraint\Constraint $urlConstraint=null)
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractController
 _getBootstrap ()
 
 setUp ()
 
 tearDown ()
 
 assertPostConditions ()
 
 getMessages ( $messageType=null, $messageManagerClass=\Magento\Framework\Message\Manager::class)
 
- Protected Attributes inherited from AbstractController
 $_runCode = ''
 
 $_runScope = 'store'
 
 $_runOptions = []
 
 $_request
 
 $_response
 
 $_objectManager
 
 $_assertSessionErrors = false
 

Detailed Description

Definition at line 12 of file PageTest.php.

Member Function Documentation

◆ testAddBreadcrumbs()

testAddBreadcrumbs ( )

Test \Magento\Cms\Block\Page::_addBreadcrumbs

Definition at line 33 of file PageTest.php.

34  {
35  $this->dispatch('/enable-cookies');
37  \Magento\Framework\View\LayoutInterface::class
38  );
39  $breadcrumbsBlock = $layout->getBlock('breadcrumbs');
40  $this->assertContains($breadcrumbsBlock->toHtml(), $this->getResponse()->getBody());
41  }

◆ testCreatePageWithSameModuleName()

testCreatePageWithSameModuleName ( )

@magentoDataFixture cmsPageWithSystemRouteFixture

Definition at line 46 of file PageTest.php.

47  {
48  $this->dispatch('/shipping');
49  $content = $this->getResponse()->getBody();
50  $this->assertContains('Shipping Test Page', $content);
51  }

◆ testViewAction()

testViewAction ( )

Definition at line 14 of file PageTest.php.

15  {
16  $this->dispatch('/enable-cookies');
17  $this->assertContains('What are Cookies?', $this->getResponse()->getBody());
18  }

◆ testViewRedirectWithTrailingSlash()

testViewRedirectWithTrailingSlash ( )

Definition at line 20 of file PageTest.php.

21  {
22  $this->dispatch('/enable-cookies/');
23  $code = $this->getResponse()->getStatusCode();
24  $location = $this->getResponse()->getHeader('Location')->getFieldValue();
25 
26  $this->assertEquals(301, $code, 'Invalid response code');
27  $this->assertStringEndsWith('/enable-cookies', $location, 'Invalid location header');
28  }
$code
Definition: info.phtml:12

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