2009-06-26 01:40:41 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once('PHPUnit/Framework.php');
|
|
|
|
require_once(dirname(__FILE__) . '/../../mockpress/mockpress.php');
|
|
|
|
require_once(dirname(__FILE__) . '/../classes/PluginWonderfulWidget.php');
|
|
|
|
|
|
|
|
class PluginWonderfulWidgetTest extends PHPUnit_Framework_TestCase {
|
|
|
|
function setUp() {
|
|
|
|
_reset_wp();
|
|
|
|
$this->w = new PluginWonderfulWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
function testInitialize() {
|
|
|
|
global $wp_test_expectations;
|
|
|
|
|
|
|
|
$this->w = new PluginWonderfulWidget();
|
|
|
|
$this->assertEquals("Plugin Wonderful", $wp_test_expectations['wp_widgets']['plugin-wonderful']['name']);
|
|
|
|
}
|
2009-06-29 10:57:05 +00:00
|
|
|
|
|
|
|
function testRenderWidget() {
|
2009-06-26 10:53:10 +00:00
|
|
|
global $plugin_wonderful;
|
2009-06-29 10:57:05 +00:00
|
|
|
$plugin_wonderful = $this->getMock('PluginWonderful', array('_render_adbox'));
|
|
|
|
$plugin_wonderful->expects($this->once())->method('_render_adbox');
|
2009-06-26 10:53:10 +00:00
|
|
|
|
2009-06-29 10:57:05 +00:00
|
|
|
$this->w->widget(array(), array());
|
2009-06-26 10:53:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testRenderWidgetControl() {
|
|
|
|
global $plugin_wonderful;
|
2009-07-01 02:50:55 +00:00
|
|
|
$plugin_wonderful = $this->getMock('PluginWonderful', array('_render_adbox_admin'));
|
|
|
|
$plugin_wonderful->expects($this->once())->method('_render_adbox_admin');
|
2009-06-26 10:53:10 +00:00
|
|
|
|
2009-07-01 02:50:55 +00:00
|
|
|
$this->w->form(array());
|
2009-06-26 10:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testUpdateWidget() {
|
|
|
|
$this->assertEquals(array('adboxid' => 5, 'center' => 0), $this->w->update(array('adboxid' => 5), array('adboxid' => 4, 'center' => 1)));
|
|
|
|
}
|
2009-06-26 01:40:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|