media() public static method

Generates a single media object.
public static media ( string $image, string $heading, string $content, array $htmlOptions = [] ) : string
$image string the image url.
$heading string the heading text.
$content string the content text.
$htmlOptions array additional HTML attributes.
return string the media object.
コード例 #1
0
 public function testMedia()
 {
     $I = $this->codeGuy;
     $html = TbHtml::media('image.png', 'Heading text', 'Content text', array('class' => 'div', 'linkOptions' => array('class' => 'link'), 'imageOptions' => array('class' => 'image', 'alt' => 'Alternative text'), 'contentOptions' => array('class' => 'content'), 'headingOptions' => array('class' => 'heading')));
     $div = $I->createNode($html, 'div.media');
     $I->seeNodeCssClass($div, 'div');
     $I->seeNodeChildren($div, array('a.pull-left', 'div.media-body'));
     $a = $div->filter('a.pull-left');
     $I->seeNodeCssClass($a, 'link');
     $I->seeNodeAttribute($a, 'href', '#');
     $img = $a->filter('img.media-object');
     $I->seeNodeCssClass($img, 'image');
     $I->seeNodeAttributes($img, array('src' => 'image.png', 'alt' => 'Alternative text'));
     $content = $div->filter('div.media-body');
     $I->seeNodeCssClass($content, 'content');
     $I->seeNodeText($content, 'Content text');
     $h4 = $content->filter('h4.media-heading');
     $I->seeNodeCssClass($h4, 'heading');
     $I->seeNodeText($h4, 'Heading text');
 }