From f00464abe72ed524b5a681a8941d5cc88ed57aa9 Mon Sep 17 00:00:00 2001 From: Dmytro Sokil Date: Sat, 25 Jan 2014 19:18:03 +0200 Subject: [PATCH] fix skipoffset placement --- src/Sokil/Vast/Ad/InLine/Creative/Linear.php | 2 +- test/Sokil/Vast/DocumentTest.php | 105 ------------------- 2 files changed, 1 insertion(+), 106 deletions(-) diff --git a/src/Sokil/Vast/Ad/InLine/Creative/Linear.php b/src/Sokil/Vast/Ad/InLine/Creative/Linear.php index 0b5ddff..4d5c0f2 100644 --- a/src/Sokil/Vast/Ad/InLine/Creative/Linear.php +++ b/src/Sokil/Vast/Ad/InLine/Creative/Linear.php @@ -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; } diff --git a/test/Sokil/Vast/DocumentTest.php b/test/Sokil/Vast/DocumentTest.php index 8286cca..2b0ee69 100644 --- a/test/Sokil/Vast/DocumentTest.php +++ b/test/Sokil/Vast/DocumentTest.php @@ -4,110 +4,5 @@ class DocumentTest extends \PHPUnit_Framework_TestCase { - public function testCreateDocument() - { - // expected document - $expectedDom = new \DOMDocument('1.0', 'URT-8'); - $expectedDom->loadXML(' - - - - Ad Server Name - Ad Title - - - - - 00:02:08 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - '); - - // 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(' - - - - - - - - - '); - $this->assertEquals('ad2', $document->getAdSections()[1]->getId()); - } } \ No newline at end of file