rearrange initialization
This commit is contained in:
parent
8e43095c9f
commit
1c97eee3e9
@ -6,6 +6,7 @@ class PluginWonderful {
|
|||||||
function PluginWonderful() {}
|
function PluginWonderful() {}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
if (empty($this->adboxes_client)) {
|
||||||
$this->messages = array();
|
$this->messages = array();
|
||||||
$this->adboxes_client = new PWAdboxesClient();
|
$this->adboxes_client = new PWAdboxesClient();
|
||||||
$this->publisher_info = false;
|
$this->publisher_info = false;
|
||||||
@ -37,6 +38,7 @@ class PluginWonderful {
|
|||||||
|
|
||||||
if (!empty($_POST)) { $this->handle_action(); }
|
if (!empty($_POST)) { $this->handle_action(); }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function insert_rss_feed_ads($content) {
|
function insert_rss_feed_ads($content) {
|
||||||
if (is_feed()) {
|
if (is_feed()) {
|
||||||
@ -118,6 +120,7 @@ class PluginWonderful {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle_activation() {
|
function handle_activation() {
|
||||||
|
$this->init();
|
||||||
$this->adboxes_client->initialize();
|
$this->adboxes_client->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,16 @@ class PluginWonderfulTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->assertTrue(_xpath_test($xml, $xpath, $value), $xpath);
|
$this->assertTrue(_xpath_test($xml, $xpath, $value), $xpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testHandleActivation() {
|
||||||
|
$pw = $this->getMock('PluginWonderful', array('init'));
|
||||||
|
$pw->adboxes_client = $this->getMock('PWAdboxesClient', array('initialize'));
|
||||||
|
|
||||||
|
$pw->expects($this->once())->method("init");
|
||||||
|
$pw->adboxes_client->expects($this->once())->method('initialize');
|
||||||
|
|
||||||
|
$pw->handle_activation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user