function test_function_and_shortcode_is_equal() { $utcw = UTCW_Plugin::getInstance(); $shortCode = new UTCW_ShortCode($utcw); $this->expectOutputString($shortCode->render(array())); do_utcw(array()); }
} break; case 'Integer': return 10; case 'Measurement': return '"10px"'; case 'Boolean': return $option->getDefaultValue() ? 0 : 1; case 'String': return '"foo"'; case 'Class': return 'ClassName'; default: die('Unknown type: ' . $type); } } public function getDocumentation() { $documentation = []; foreach ($this->configurationObjects as $configurationObject) { $documentation = array_merge($documentation, $this->getDocumentationForConfig($configurationObject)); } $result = join("\n", $documentation); $result .= "\n"; $result .= '*Configuration options auto generated at ' . date('Y-m-d H:i:s') . ' for version ' . $this->version . '*'; return $result; } } $objects = [new UTCW_DataConfig(array(), UTCW_Plugin::getInstance()), new UTCW_RenderConfig(array(), UTCW_Plugin::getInstance())]; $generator = new DocumentationGenerator($objects, UTCW_VERSION); echo $generator->getDocumentation();
function test_plugin_singleton() { $utcw = UTCW_Plugin::getInstance(); $this->assertTrue($utcw instanceof UTCW_Plugin); }
/** * Get a new instance of the plugin * * @since 2.6 */ public function __wakeup() { $this->plugin = UTCW_Plugin::getInstance(); }
function setUp() { $this->plugin = UTCW_Plugin::getInstance(); $this->shortCode = new UTCW_ShortCode($this->plugin); }
/** * Function for theme integration * * @param array $args * * @since 1.3 */ function do_utcw(array $args) { $plugin = UTCW_Plugin::getInstance(); $shortCode = new UTCW_ShortCode($plugin); echo $shortCode->render($args); }
/** * Reinitialize the private members when waking up */ public function __wakeup() { $this->init(UTCW_Plugin::getInstance()); }
/** * Constructor * * @param UTCW_Plugin $plugin Optional. UTCW_Plugin instance for dependency injection * * @return UTCW_Widget * @since 1.0 */ public function __construct(UTCW_Plugin $plugin = null) { $options = array('description' => __('Highly configurable tag cloud', 'utcw')); parent::__construct('utcw', __('Ultimate Tag Cloud', 'utcw'), $options); $this->plugin = $plugin ? $plugin : UTCW_Plugin::getInstance(); }