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

Public Member Functions

 testGetCustomerFieldFromFormData ($field, $value)
 
 formDataProvider ()
 
 customerSessionDataProvider ()
 

Protected Member Functions

 setUp ()
 
 _callBlockMethod ($field)
 

Protected Attributes

 $_block
 

Detailed Description

Definition at line 10 of file SendTest.php.

Member Function Documentation

◆ _callBlockMethod()

_callBlockMethod (   $field)
protected

Call block method based on form field

Parameters
string$field
Returns
null|string

Definition at line 84 of file SendTest.php.

85  {
86  switch ($field) {
87  case 'name':
88  return $this->_block->getUserName();
89  case 'email':
90  return $this->_block->getEmail();
91  default:
92  return null;
93  }
94  }

◆ customerSessionDataProvider()

customerSessionDataProvider ( )
Returns
array

Definition at line 70 of file SendTest.php.

71  {
72  return [
73  ['name', 'John Smith'],
74  ['email', '[email protected]']
75  ];
76  }

◆ formDataProvider()

formDataProvider ( )
Returns
array

Definition at line 39 of file SendTest.php.

40  {
41  return [
42  ['name', 'Customer Form Name'],
43  ['email', '[email protected]']
44  ];
45  }

◆ setUp()

setUp ( )
protected

Definition at line 17 of file SendTest.php.

18  {
19  $this->_block = Bootstrap::getObjectManager()->create(\Magento\SendFriend\Block\Send::class);
20  }

◆ testGetCustomerFieldFromFormData()

testGetCustomerFieldFromFormData (   $field,
  $value 
)
Parameters
string$field
string$value@dataProvider formDataProvider @covers \Magento\SendFriend\Block\Send::getUserName @covers \Magento\SendFriend\Block\Send::getEmail

Definition at line 29 of file SendTest.php.

30  {
31  $formData = ['sender' => [$field => $value]];
32  $this->_block->setFormData($formData);
33  $this->assertEquals(trim($value), $this->_callBlockMethod($field));
34  }
$value
Definition: gender.phtml:16

Field Documentation

◆ $_block

$_block
protected

Definition at line 15 of file SendTest.php.


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