RobotsTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Robots\Test\Unit\Model;
  7. use Magento\Framework\App\Config\ScopeConfigInterface;
  8. use Magento\Robots\Model\Robots;
  9. use Magento\Store\Model\ScopeInterface;
  10. class RobotsTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
  14. */
  15. private $scopeConfigMock;
  16. /**
  17. * @var Robots
  18. */
  19. private $model;
  20. protected function setUp()
  21. {
  22. $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
  23. ->getMockForAbstractClass();
  24. $this->model = new Robots(
  25. $this->scopeConfigMock
  26. );
  27. }
  28. /**
  29. * Check general logic of getData() method
  30. */
  31. public function testGetData()
  32. {
  33. $customInstructions = 'custom_instructions';
  34. $this->scopeConfigMock->expects($this->once())
  35. ->method('getValue')
  36. ->with(
  37. 'design/search_engine_robots/custom_instructions',
  38. ScopeInterface::SCOPE_WEBSITE
  39. )
  40. ->willReturn($customInstructions);
  41. $this->assertEquals($customInstructions, $this->model->getData());
  42. }
  43. }