ProductTest.php 970 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Test class for \Magento\Catalog\Controller\Product (downloadable product type)
  8. */
  9. namespace Magento\Downloadable\Controller;
  10. class ProductTest extends \Magento\TestFramework\TestCase\AbstractController
  11. {
  12. /**
  13. * @magentoDataFixture Magento/Downloadable/_files/product_downloadable.php
  14. */
  15. public function testViewAction()
  16. {
  17. $this->dispatch('catalog/product/view/id/1');
  18. $responseBody = $this->getResponse()->getBody();
  19. $this->assertContains('Downloadable Product', $responseBody);
  20. $this->assertContains('In stock', $responseBody);
  21. $this->assertContains('Add to Cart', $responseBody);
  22. $actualLinkCount = substr_count($responseBody, 'Downloadable Product Link');
  23. $this->assertEquals(1, $actualLinkCount, 'Downloadable product link should appear on the page exactly once.');
  24. }
  25. }