Skip to content

Commit

Permalink
fix skipoffset placement
Browse files Browse the repository at this point in the history
  • Loading branch information
sokil committed Jan 25, 2014
1 parent e659363 commit f00464a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 106 deletions.
2 changes: 1 addition & 1 deletion src/Sokil/Vast/Ad/InLine/Creative/Linear.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public function skipAfter($time) {
$time = $this->_secondsToString($time);
}

$this->_domElement->setAttribute('skipoffset', $time);
$this->_domElement->firstChild->setAttribute('skipoffset', $time);

return $this;
}
Expand Down
105 changes: 0 additions & 105 deletions test/Sokil/Vast/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,110 +4,5 @@

class DocumentTest extends \PHPUnit_Framework_TestCase
{
public function testCreateDocument()
{
// expected document
$expectedDom = new \DOMDocument('1.0', 'URT-8');
$expectedDom->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
<Ad id="ad1">
<InLine>
<AdSystem>Ad Server Name</AdSystem>
<AdTitle>Ad Title</AdTitle>
<Impression><![CDATA[http://ad.server.com/impression]]></Impression>
<Creatives>
<Creative>
<Linear skipoffset="00:02:01">
<Duration>00:02:08</Duration>
<VideoClips>
<ClickThrough><![CDATA[http://ad.server.com/videoclips/clickthrough]]></ClickThrough>
<ClickTracking><![CDATA[http://ad.server.com/videoclips/clicktracking]]></ClickTracking>
<CustomClick><![CDATA[http://ad.server.com/videoclips/customclick]]></CustomClick>
</VideoClips>
<TrackingEvents>
<Tracking event="skip"><![CDATA[http://ad.server.com/trackingevent/skip]]></Tracking>
<Tracking event="start"><![CDATA[http://ad.server.com/trackingevent/start]]></Tracking>
<Tracking event="mute"><![CDATA[http://ad.server.com/trackingevent/stop]]></Tracking>
</TrackingEvents>
<MediaFiles>
<MediaFile delivery="progressive" type="video/mp4" height="100" width="100">
<![CDATA[http://server.com/media.mp4]]>
</MediaFile>
</MediaFiles>
</Linear>
</Creative>
</Creatives>
<Extensions>
<Extension type="startTime">
<![CDATA[00:01]]>
</Extension>
<Extension type="skipTime">
<![CDATA[05:02]]>
</Extension>
</Extensions>
</InLine>
</Ad>
<Ad id="ad2">
<Wrapper/>
</Ad>
</VAST>');

// create document
$document = \Sokil\Vast\Document::create('2.0');

// insert Ad section
$ad1 = $document->createInLineAdSection()
->setId('ad1')
->setAdSystem('Ad Server Name')
->setAdTitle('Ad Title')
->setImpression('http://ad.server.com/impression');

// create creative for ad section
$ad1->createLinearCreative()
->setDuration(128)
->setVideoClipsClickThrough('http://ad.server.com/videoclips/clickthrough')
->addVideoClipsClickTracking('http://ad.server.com/videoclips/clicktracking')
->addVideoClipsCustomClick('http://ad.server.com/videoclips/customclick')
->skipAfter(121)
->addTrackingEvent('skip', 'http://ad.server.com/trackingevent/start')
->addTrackingEvent('start', 'http://ad.server.com/trackingevent/start')
->addTrackingEvent('mute', 'http://ad.server.com/trackingevent/stop')
->createMediaFile()
->setProgressiveDelivery()
->setType('video/mp4')
->setHeight(100)
->setWidth(100)
->setUrl('http://server.com/media.mp4');

$ad1
->addExtension('startTime', '00:01')
->addExtension('skipTime', '00:02');

// insert another ad section
$document->createWrapperAdSection()->setId('ad2');

// die($document);

// test
$this->assertEqualXMLStructure(
$expectedDom->firstChild,
$document->toDomDocument()->firstChild
);
}

public function testLoadDocumentFromString()
{
$document = \Sokil\Vast\Document::fromString('<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
<Ad id="ad1">
<InLine/>
</Ad>
<Ad id="ad2">
<Wrapper/>
</Ad>
</VAST>
');

$this->assertEquals('ad2', $document->getAdSections()[1]->getId());
}
}

0 comments on commit f00464a

Please sign in to comment.