FontAwesome6IconTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace Tools\Test\TestCase\View\Icon;
  3. use Cake\TestSuite\TestCase;
  4. use Tools\View\Icon\FontAwesome6Icon;
  5. class FontAwesome6IconTest extends TestCase {
  6. /**
  7. * @var \Tools\View\Icon\FontAwesome6Icon
  8. */
  9. protected $icon;
  10. /**
  11. * @return void
  12. */
  13. public function setUp(): void {
  14. parent::setUp();
  15. $this->icon = new FontAwesome6Icon();
  16. }
  17. /**
  18. * @return void
  19. */
  20. public function testRender(): void {
  21. $result = $this->icon->render('camera-retro');
  22. $this->assertSame('<span class="fa-solid fa-camera-retro"></span>', $result);
  23. }
  24. /**
  25. * @return void
  26. */
  27. public function testRenderLight(): void {
  28. $this->icon = new FontAwesome6Icon(['namespace' => 'light']);
  29. $result = $this->icon->render('camera-retro');
  30. $this->assertSame('<span class="fa-light fa-camera-retro"></span>', $result);
  31. }
  32. /**
  33. * @return void
  34. */
  35. public function testRenderRotate(): void {
  36. $result = $this->icon->render('camera-retro', ['rotate' => 90]);
  37. $this->assertSame('<span class="fa-solid fa-rotate-90 fa-camera-retro"></span>', $result);
  38. }
  39. /**
  40. * @return void
  41. */
  42. public function testRenderSpin(): void {
  43. $result = $this->icon->render('camera-retro', ['spin' => true]);
  44. $this->assertSame('<span class="fa-solid fa-spin fa-camera-retro"></span>', $result);
  45. }
  46. }