NullValueTest.php 916 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare(strict_types = 1);
  3. namespace DASPRiD\EnumTest;
  4. use DASPRiD\Enum\Exception\CloneNotSupportedException;
  5. use DASPRiD\Enum\Exception\SerializeNotSupportedException;
  6. use DASPRiD\Enum\Exception\UnserializeNotSupportedException;
  7. use DASPRiD\Enum\NullValue;
  8. use PHPUnit\Framework\TestCase;
  9. final class NullValueTest extends TestCase
  10. {
  11. public function testExceptionOnCloneAttempt() : void
  12. {
  13. $this->expectException(CloneNotSupportedException::class);
  14. clone NullValue::instance();
  15. }
  16. public function testExceptionOnSerializeAttempt() : void
  17. {
  18. $this->expectException(SerializeNotSupportedException::class);
  19. serialize(NullValue::instance());
  20. }
  21. public function testExceptionOnUnserializeAttempt() : void
  22. {
  23. $this->expectException(UnserializeNotSupportedException::class);
  24. unserialize('O:22:"DASPRiD\\Enum\\NullValue":0:{}');
  25. }
  26. }