function testEmailNotification() { // test requires xdebug and xdebug_get_declared_vars(). if (!extension_loaded('xdebug')) { echo ($msg = "Need xdebug extension for email notification test") . "\n"; $this->markTestIncomplete($msg); } if (ini_get('xdebug.collect_vars') != 1) { echo ($msg = "need to set xdebug.collect_vars = 1") . "\n"; $this->markTestIncomplete($msg); } $this->assertEquals($GLOBALS['this_test_requires_globals'], "test", "xdebug not working - or need to update phpunit? see http://pear.php.net/bugs/bug.php?id=5053 for more info."); // hook mail() global $mail_testing_callback; $mail_testing_callback = array("EmailNotificationTest", "mail_hook"); // load main network and get a fake owner user global $network_info, $owner; $network_info = Network::get_mothership_info(); $owner = Test::get_test_user(); // override destination so we get an e-mail $extra = unserialize($network_info->extra); $extra['notify_owner']['announcement']['value'] = NET_EMAIL; $extra['notify_owner']['content_to_homepage']['value'] = NET_EMAIL; $network_info->extra = serialize($extra); $this->assertEquals(count(EmailNotificationTest::$messages), 0); // now trigger a fake network announcement $owner_name = 'John Q. NetworkOwner'; announcement(array('params' => array('aid' => "whatever"), 'owner_name' => $owner_name)); $this->assertEquals(count(EmailNotificationTest::$messages), 1); $msg = EmailNotificationTest::$messages[0]; $this->assertContains("nnouncement", $msg[1]); $this->assertContains("network", $msg[1]); $this->assertContains($owner_name, $msg[2]); $this->assertContains("nnouncement", $msg[2]); // now trigger a fake content posting to community blog $comm_blog_post = array('owner_name' => $owner_name, 'params' => array('first_name' => "Firstname", 'network_name' => "Network Name", 'user_id' => $owner->user_id, 'user_image' => $owner->picture, 'cid' => '1234', 'content_title' => 'Fake content title')); content_posted_to_comm_blog($comm_blog_post); $this->assertEquals(count(EmailNotificationTest::$messages), 2); $msg = EmailNotificationTest::$messages[1]; $this->assertContains("Community Blog", $msg[1]); $this->assertContains("posted", $msg[1]); $this->assertContains($owner_name, $msg[2]); $this->assertContains("Firstname has posted", $msg[2]); echo "The site name is " . PA::$site_name . "\n"; $this->assertContains(PA::$site_name, $msg[2]); /* The following test won't work yet -- as the site name is inserted in the messages early, so changing it now won't have any effect. // now change the site name and make sure it shows up properly $old_config_site_name = PA::$site_name; $new_config_site_name = PA::$site_name = "Test site name - for EmailNotificationTest"; content_posted_to_comm_blog($comm_blog_post); $this->assertEquals(count(EmailNotificationTest::$messages), 3); $msg = EmailNotificationTest::$messages[2]; $this->assertContains("Community Blog", $msg[1]); $this->assertContains("posted", $msg[1]); $this->assertContains($owner_name, $msg[2]); $this->assertContains("Firstname has posted", $msg[2]); echo "The site name is ". PA::$site_name ."\n"; $this->assertContains(PA::$site_name, $msg[2]); $this->assertNotContains($old_config_site_name, $msg[2]); $this->assertNotContains("PeopleAggregator", $msg[2]); */ }
} try { $flux = new RssFeed($url); $fluxArray[] = $flux; } catch (Exception $e) { //echo 'Exception : ' . $e->getMessage() . "</br>\n"; echo 'RSS invalide' . '<br/>' . "\n"; } try { $flux1 = new RssFeed('http://www.jeuxvideo.com/rss/rss-news.xml'); $fluxArray[] = $flux1; } catch (Exception $e) { //echo 'Exception : ' . $e->getMessage() . "</br>\n"; echo 'RSS invalide' . '<br/>' . "\n"; } announcement($fluxArray); echo ' <h1 id="titre">Test RSS</h1><br/>' . "\n"; ?> <form class="inputtocenter" action="vue_testRSS.php" method="get"> <table> <tr> <td>rss</td> <td><label for="rssfeed"><input id="rssfeed" type="text" name="rssfeed" value=""/></label><br/></td> </tr> </table> </form> <?php $liens[] = '../index.php'; $noms[] = 'accueil'; $images[] = 'static/images/favicon.svg';
?> <li> <h2><?php the_title(); ?> </h2> <br/> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail(array(80, 70)); ?> </a> <?php announcement('segment_length', 'segment_more'); ?> <a href="<?php the_permalink(); ?> "> <span class="more"> Читать полностью » </span> </a> <br/> </li> <?php } ?> </ul>