From c01a292d9c90dbb342bfb4fa51be6197ff4b0669 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 28 Jun 2009 21:17:42 -0400 Subject: [PATCH] insert rss feed ads test --- test/PluginWonderfulTest.php | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/test/PluginWonderfulTest.php b/test/PluginWonderfulTest.php index 01c378a..eb994de 100644 --- a/test/PluginWonderfulTest.php +++ b/test/PluginWonderfulTest.php @@ -175,8 +175,38 @@ class PluginWonderfulTest extends PHPUnit_Framework_TestCase { $this->assertEquals("test", ob_get_clean()); } - function testInsertAdsIntoRSS() { - $this->markTestIncomplete(); + function providerInsertAdsIntoRSS() { + return array( + array(false, false, 0), + array(true, false, 0), + array(true, true, 0), + array(true, true, 1) + ); + } + + /** + * @dataProvider providerInsertAdsIntoRSS + */ + function testInsertAdsIntoRSS($is_feed, $publisher_info, $in_rss_feed) { + _set_current_option('is_feed', $is_feed); + + if ($is_feed) { + if ($publisher_info) { + $this->pw->publisher_info = (object)array( + 'adboxes' => array( + (object)array('advancedcode' => "", 'in_rss_feed' => $in_rss_feed) + ) + ); + } else { + $this->pw->publisher_info = false; + } + } + + ob_start(); + $this->pw->insert_rss_feed_ads("body"); + $source = ob_get_clean(); + + $this->assertEquals($is_feed && $publisher_info && ($in_rss_feed == 1), !empty($source)); } function testInsertActivationAd() { @@ -215,6 +245,7 @@ class PluginWonderfulTest extends PHPUnit_Framework_TestCase { } function testCreateTarget() { + $this->markTestIncomplete(); }