Beispiel #1
0
 /**
  * @magentoDataFixture Magento/Customer/_files/attribute_user_fullname.php
  */
 public function testToHtmlFancyName()
 {
     /** @var \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder */
     $customerBuilder = Bootstrap::getObjectManager()->get('Magento\\Customer\\Service\\V1\\Data\\CustomerBuilder');
     $customerBuilder->setPrefix('Dr.')->setFirstname('Jane')->setMiddlename('Roe')->setLastname('Doe')->setSuffix('Ph.D.');
     $this->_block->setObject($customerBuilder->create());
     $html = $this->_block->toHtml();
     $this->assertContains('title="First Name"', $html);
     $this->assertContains('value="Jane"', $html);
     $this->assertContains('title="Last Name"', $html);
     $this->assertContains('value="Doe"', $html);
     $this->assertContains('title="Middle Name/Initial"', $html);
     $this->assertContains('value="Roe"', $html);
     $this->assertContains('title="Prefix"', $html);
     $this->assertContains('value="Dr."', $html);
     $this->assertContains('title="Suffix"', $html);
     $this->assertContains('value="Ph.D."', $html);
 }
Beispiel #2
0
 /**
  * @magentoAppIsolation enabled
  * @magentoDataFixture Magento/Customer/_files/attribute_user_fullname.php
  */
 public function testToHtmlFancyName()
 {
     /** @var \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory */
     $customerFactory = Bootstrap::getObjectManager()->get('Magento\\Customer\\Api\\Data\\CustomerInterfaceFactory');
     $customerDataObject = $customerFactory->create();
     $customerDataObject->setPrefix('Dr.')->setFirstname('Jane')->setMiddlename('Roe')->setLastname('Doe')->setSuffix('Ph.D.');
     $this->_block->setObject($customerDataObject);
     $html = $this->_block->toHtml();
     $this->assertContains('title="First Name"', $html);
     $this->assertContains('value="Jane"', $html);
     $this->assertContains('title="Last Name"', $html);
     $this->assertContains('value="Doe"', $html);
     $this->assertContains('title="Middle Name/Initial"', $html);
     $this->assertContains('value="Roe"', $html);
     $this->assertContains('title="Prefix"', $html);
     $this->assertContains('value="Dr."', $html);
     $this->assertContains('title="Suffix"', $html);
     $this->assertContains('value="Ph.D."', $html);
 }
Beispiel #3
0
 /**
  * Helper method for testing all is*Required() methods.
  */
 private function _setUpIsAttributeRequired()
 {
     /**
      * These settings cause the first code path in Name::_getAttribute() to be skipped so that the rest of
      * the code in the other code path(s) can be executed.
      */
     $this->_block->setForceUseCustomerAttributes(false);
     $this->_block->setForceUseCustomerRequiredAttributes(true);
     $this->_block->setObject(new \StdClass());
     /**
      * The first call to isRequired() is false so that the second if conditional in the other code path
      * of Name::_getAttribute() will evaluate to true, which causes the if's code block to be executed.
      * The second isRequired() call causes the code in the nested if conditional to be executed. Thus,
      * all code paths in Name::_getAttribute() will be executed. Returning true for the third isRequired()
      * call causes the is*Required() method of the block to return true for the attribute.
      */
     $this->attribute->expects($this->at(0))->method('isRequired')->will($this->returnValue(false));
     $this->attribute->expects($this->at(1))->method('isRequired')->will($this->returnValue(true));
     $this->attribute->expects($this->at(2))->method('isRequired')->will($this->returnValue(true));
 }