![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Wishlist\Block\Customer; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\View\LayoutInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\Helper\Xpath; use PHPUnit\Framework\TestCase; /** * Class test share wish list block. * * @magentoDbIsolation enabled * @magentoAppArea frontend */ class SharingTest extends TestCase { /** @var ObjectManagerInterface */ private $objectManager; /** @var Sharing */ private $block; /** * @inheritdoc */ protected function setUp(): void { parent::setUp(); $this->objectManager = Bootstrap::getObjectManager(); $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Sharing::class); } /** * @return void */ public function testDisplayWishListSharingForm(): void { $elementsXpath = [ 'Emails input' => "//form[contains(@class, 'share')]//textarea[@name='emails' and @id='email_address']", 'Message input' => "//form[contains(@class, 'share')]//textarea[@name='message' and @id='message']", 'Share button' => "//form[contains(@class, 'share')]//button[contains(@class, 'submit')]" . "/span[contains(text(), 'Share Wish List')]", ]; $blockHtml = $this->block->setTemplate('Magento_Wishlist::sharing.phtml')->toHtml(); foreach ($elementsXpath as $element => $xpath) { $this->assertEquals( 1, Xpath::getElementsCountForXpath($xpath, $blockHtml), sprintf("%s was not found.", $element) ); } } }