ContactUrlTest.php 783 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace CMText\RichContent\Common;
  3. use CMText\Exceptions\ContactUrlException;
  4. use PHPUnit\Framework\TestCase;
  5. class ContactUrlTest extends TestCase
  6. {
  7. public function testJsonSerialize()
  8. {
  9. $this->assertJson( json_encode(new ContactUrl('https://cm.com')) );
  10. }
  11. public function test__construct()
  12. {
  13. // partial
  14. $this->assertInstanceOf(
  15. ContactUrl::class,
  16. new ContactUrl('https://cm.com')
  17. );
  18. // full
  19. $this->assertInstanceOf(
  20. ContactUrl::class,
  21. new ContactUrl('https://cm.com', 'AWESOME')
  22. );
  23. }
  24. public function testContactUrlException()
  25. {
  26. $this->expectException(ContactUrlException::class);
  27. new ContactUrl(__LINE__);
  28. }
  29. }