TemplateTest.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Backend\Block;
  7. /**
  8. * Test class for \Magento\Backend\Block\Template.
  9. *
  10. * @magentoAppArea adminhtml
  11. */
  12. class TemplateTest extends \PHPUnit\Framework\TestCase
  13. {
  14. /**
  15. * @var \Magento\Backend\Block\Template
  16. */
  17. protected $_block;
  18. protected function setUp()
  19. {
  20. parent::setUp();
  21. $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
  22. \Magento\Framework\View\LayoutInterface::class
  23. )->createBlock(
  24. \Magento\Backend\Block\Template::class
  25. );
  26. }
  27. /**
  28. * @covers \Magento\Backend\Block\Template::getFormKey
  29. */
  30. public function testGetFormKey()
  31. {
  32. $this->assertGreaterThan(15, strlen($this->_block->getFormKey()));
  33. }
  34. /**
  35. * @magentoAppArea adminhtml
  36. * @covers \Magento\Backend\Block\Template::isOutputEnabled
  37. * @magentoConfigFixture current_store advanced/modules_disable_output/dummy 1
  38. */
  39. public function testIsOutputEnabledTrue()
  40. {
  41. $this->_block->setData('module_name', 'dummy');
  42. $this->assertFalse($this->_block->isOutputEnabled('dummy'));
  43. }
  44. /**
  45. * @magentoAppArea adminhtml
  46. * @covers \Magento\Backend\Block\Template::isOutputEnabled
  47. * @magentoConfigFixture current_store advanced/modules_disable_output/dummy 0
  48. */
  49. public function testIsOutputEnabledFalse()
  50. {
  51. $this->_block->setData('module_name', 'dummy');
  52. $this->assertTrue($this->_block->isOutputEnabled('dummy'));
  53. }
  54. }