BxPostsTemplateTest.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Content-module template helpers via Posts.
  4. */
  5. class BxPostsTemplateTest extends BxPostsTestCase
  6. {
  7. public function testUnitNameClassAndHtmlId()
  8. {
  9. $o = $this->bxTemplate();
  10. $aPost = $this->bxSamplePost();
  11. $this->assertSame('unit', $this->bxCallProtected($o, '_getUnitName', $aPost, 'unit.html'));
  12. $this->assertSame('unit_gallery', $this->bxCallProtected($o, '_getUnitName', $aPost, 'unit_gallery.html'));
  13. $this->assertSame('', $this->bxCallProtected($o, '_getUnitClass', $aPost, 'unit.html'));
  14. $this->assertSame(
  15. 'bx-base-unit-showcase bx-base-text-unit-showcase bx-def-margin-sec-bottom',
  16. $this->bxCallProtected($o, '_getUnitClass', $aPost, 'unit_showcase.html')
  17. );
  18. $this->assertSame('bx-posts-unit-15', $this->bxCallProtected($o, '_getUnitHtmlId', $aPost, 'unit.html'));
  19. }
  20. public function testHeaderImageParams()
  21. {
  22. $a = $this->bxCallProtected($this->bxTemplate(), '_getHeaderImageParams');
  23. $this->assertSame('thumb', $a['field']);
  24. $this->assertSame('thumb_data', $a['field_position']);
  25. $this->assertSame('bx_posts_covers', $a['storage']);
  26. $this->assertSame(['bx_posts_html5'], $a['uploaders']);
  27. $this->assertSame('bx_posts_cover', $a['transcoder_cover']);
  28. }
  29. public function testCheckPrivacySkippedReturnsEmpty()
  30. {
  31. $s = $this->bxCallProtected(
  32. $this->bxTemplate(),
  33. 'checkPrivacy',
  34. $this->bxSamplePost(),
  35. false,
  36. $this->_oModule
  37. );
  38. $this->assertSame('', $s);
  39. }
  40. public function testMediaExifEmpty()
  41. {
  42. $this->assertSame('', $this->_oModule->_oTemplate->mediaExif([]));
  43. $this->assertSame('', $this->_oModule->_oTemplate->mediaExif(['exif' => serialize(['Model' => 'X'])]));
  44. }
  45. public function testGetUnitThumbAndGalleryWithoutThumb()
  46. {
  47. [$sThumb, $sGallery] = $this->bxCallProtected(
  48. $this->bxTemplate(),
  49. 'getUnitThumbAndGallery',
  50. $this->bxSamplePost(['thumb' => 0])
  51. );
  52. $this->assertSame('', $sThumb);
  53. $this->assertSame('', $sGallery);
  54. }
  55. public function testAuthorAddonEmpty()
  56. {
  57. $this->assertSame('', $this->_oModule->_oTemplate->getAuthorAddon($this->bxSamplePost(), null));
  58. }
  59. }