ComponentParameterImageTest.php 696 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace CMText\RichContent\Templates\Whatsapp;
  3. use CMText\RichContent\Messages\MediaContent;
  4. use PHPUnit\Framework\TestCase;
  5. class ComponentParameterImageTest extends TestCase
  6. {
  7. public function test__construct()
  8. {
  9. $component = new ComponentParameterImage(
  10. new MediaContent(
  11. 'image name',
  12. 'https://location',
  13. 'image/png'
  14. )
  15. );
  16. $json = json_decode(json_encode($component));
  17. $this->assertEquals(
  18. ComponentParameterImage::TYPE,
  19. $json->type
  20. );
  21. $this->assertObjectHasAttribute(
  22. 'media',
  23. $json
  24. );
  25. }
  26. }