Skip to content

Commit

Permalink
test get ad sections
Browse files Browse the repository at this point in the history
  • Loading branch information
sokil committed Jul 25, 2017
1 parent 0d8ba2a commit 4b5c5e0
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Sokil\Vast;

use Sokil\Vast\Ad\InLine;

class DocumentTest extends AbstractTestCase
{
/**
Expand Down Expand Up @@ -41,6 +43,49 @@ public function testCreateInLineAdSection()
$this->assertVastXmlEquals($expectedXml, $document);
}

/**
* Test for inline ad
*/
public function testGetAdSection()
{
$factory = new Factory();
$document = $factory->create('2.0');
$this->assertInstanceOf('\Sokil\Vast\Document', $document);

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

// create creative for ad section
$ad1
->createLinearCreative()
->setDuration(128)
->setVideoClicksClickThrough('http://entertainmentserver.com/landing')
->addVideoClicksClickTracking('http://ad.server.com/videoclicks/clicktracking')
->addVideoClicksCustomClick('http://ad.server.com/videoclicks/customclick')
->addTrackingEvent('start', 'http://ad.server.com/trackingevent/start')
->addTrackingEvent('pause', 'http://ad.server.com/trackingevent/stop')
->createMediaFile()
->setProgressiveDelivery()
->setType('video/mp4')
->setHeight(100)
->setWidth(100)
->setUrl('http://server.com/media.mp4');

$adSections = $document->getAdSections();
$this->assertSame(1, count($adSections));

/** @var InLine $adSection */
$adSection = $adSections[0];
$this->assertInstanceOf('\\Sokil\\Vast\\Ad\\InLine', $adSection);

$this->assertSame('ad1', $adSection->getId());
}

/**
* Test for wrapper ad
*/
Expand Down

0 comments on commit 4b5c5e0

Please sign in to comment.