PathTest.php 915 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Integration test for Magento\Cookie\Model\Config\Backend\Path
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Cookie\Model\Config\Backend;
  9. class PathTest extends \PHPUnit\Framework\TestCase
  10. {
  11. /**
  12. * Method is not publicly accessible, so it must be called through parent
  13. *
  14. * @expectedException \Magento\Framework\Exception\LocalizedException
  15. * @expectedExceptionMessage Invalid cookie path
  16. */
  17. public function testBeforeSaveException()
  18. {
  19. $invalidPath = 'invalid path';
  20. $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
  21. /** @var \Magento\Cookie\Model\Config\Backend\Lifetime $model */
  22. $model = $objectManager->create(\Magento\Cookie\Model\Config\Backend\Path::class);
  23. $model->setValue($invalidPath);
  24. $model->save();
  25. }
  26. }