ContactNameTest.php 819 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace CMText\RichContent\Common;
  3. use PHPUnit\Framework\TestCase;
  4. class ContactNameTest extends TestCase
  5. {
  6. public function testJsonSerialize()
  7. {
  8. $this->assertJson( json_encode(new ContactName('CM.com Be part of it.')) );
  9. }
  10. public function test__construct()
  11. {
  12. // partial
  13. $this->assertInstanceOf(
  14. ContactName::class,
  15. new ContactName('CM.com Be part of it.', 'CM.com', 'Be part of it')
  16. );
  17. // full
  18. $this->assertInstanceOf(
  19. ContactName::class,
  20. new ContactName('CM.com Be part of it.', 'CM.com', 'Be part of it', '=', '+', '-')
  21. );
  22. }
  23. public function testTypeErrorRequiredProperty()
  24. {
  25. $this->expectException(\TypeError::class);
  26. new ContactName(null);
  27. }
  28. }