ConfigurationExceptionTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php declare(strict_types=1);
  2. /*
  3. * This file is part of sebastian/diff.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace SebastianBergmann\Diff;
  11. use PHPUnit\Framework\TestCase;
  12. /**
  13. * @covers SebastianBergmann\Diff\ConfigurationException
  14. */
  15. final class ConfigurationExceptionTest extends TestCase
  16. {
  17. public function testConstructWithDefaults(): void
  18. {
  19. $e = new ConfigurationException('test', 'A', 'B');
  20. $this->assertSame(0, $e->getCode());
  21. $this->assertNull($e->getPrevious());
  22. $this->assertSame('Option "test" must be A, got "string#B".', $e->getMessage());
  23. }
  24. public function testConstruct(): void
  25. {
  26. $e = new ConfigurationException(
  27. 'test',
  28. 'integer',
  29. new \SplFileInfo(__FILE__),
  30. 789,
  31. new \BadMethodCallException(__METHOD__)
  32. );
  33. $this->assertSame('Option "test" must be integer, got "SplFileInfo".', $e->getMessage());
  34. }
  35. }