ContextFactoryTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * For full copyright and license information, please see the LICENSE.txt
  9. * Redistributions of files must retain the above copyright notice.
  10. *
  11. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  12. * @link https://cakephp.org CakePHP(tm) Project
  13. * @since 4.0.0
  14. * @license https://opensource.org/licenses/mit-license.php MIT License
  15. */
  16. namespace Cake\Test\TestCase\View\Form;
  17. use Cake\Http\ServerRequest;
  18. use Cake\TestSuite\TestCase;
  19. use Cake\View\Form\ContextFactory;
  20. /**
  21. * ContextFactory test case.
  22. */
  23. class ContextFactoryTest extends TestCase
  24. {
  25. public function testGetException()
  26. {
  27. $this->expectException(\RuntimeException::class);
  28. $this->expectExceptionMessage(
  29. 'No context provider found for value of type `boolean`.'
  30. . ' Use `null` as 1st argument of FormHelper::create() to create a context-less form.'
  31. );
  32. $factory = new ContextFactory();
  33. $factory->get(new ServerRequest(), ['entity' => false]);
  34. }
  35. }