Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
Public Member Functions | Protected Member Functions
AjaxTest Class Reference
Inheritance diagram for AjaxTest:
AbstractController

Public Member Functions

 testIndexAction ($postData, $expected)
 
 indexActionDataProvider ()
 
- 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 9 of file AjaxTest.php.

Member Function Documentation

◆ indexActionDataProvider()

indexActionDataProvider ( )

Definition at line 42 of file AjaxTest.php.

43  {
44  return [
45  [
46  [
47  [
48  'original' => 'phrase1',
49  'custom' => 'translation1'
50  ]
51  ],
52  '{"phrase1":"translation1"}'
53  ],
54  [
55  [
56  [
57  'original' => 'phrase2',
58  'custom' => 'translation2'
59  ]
60  ],
61  '{"phrase1":"translation1","phrase2":"translation2"}'
62  ]
63  ];
64  }

◆ setUp()

setUp ( )
protected

Definition at line 11 of file AjaxTest.php.

12  {
13  /* Called getConfig as workaround for setConfig bug */
15  \Magento\Store\Model\StoreManagerInterface::class
16  )->getStore(
17  'default'
18  )->getConfig(
19  'dev/translate_inline/active'
20  );
22  \Magento\Framework\App\Config\MutableScopeConfigInterface::class
23  )->setValue(
24  'dev/translate_inline/active',
25  true,
26  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
27  'default'
28  );
29  parent::setUp();
30  }

◆ testIndexAction()

testIndexAction (   $postData,
  $expected 
)

@dataProvider indexActionDataProvider

Definition at line 35 of file AjaxTest.php.

36  {
37  $this->getRequest()->setPostValue('translate', $postData);
38  $this->dispatch('translation/ajax/index');
39  $this->assertEquals($expected, $this->getResponse()->getBody());
40  }

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