Arrays.associate().error.phpt 362 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Test: Nette\Utils\Arrays::associate()
  4. */
  5. declare(strict_types=1);
  6. use Nette\Utils\Arrays;
  7. use Tester\Assert;
  8. require __DIR__ . '/../bootstrap.php';
  9. foreach (['', '=', '=age', '=>', '|', '|name'] as $path) {
  10. Assert::exception(
  11. fn() => Arrays::associate([], $path),
  12. Nette\InvalidArgumentException::class,
  13. "Invalid path '$path'.",
  14. );
  15. }