/** * @throws Exception */ private function initialize_modules() { new Hello_Kushimoto_Dashboard_Widget($this->speaker); new Hello_Kushimoto_Admin_Notices($this->speaker); new Hello_Kushimoto_Shortcode($this->speaker); if (defined('WP_CLI') and WP_CLI) { Hello_Kushimoto_CLI::set_speaker($this->speaker); WP_CLI::add_command('hello-kushimoto', 'Hello_Kushimoto_CLI'); } }
/** * @param Hello_Kushimoto_Speaker $speaker */ public function __construct(Hello_Kushimoto_Speaker $speaker) { $this->speaker = $speaker; load_plugin_textdomain('hello-kushimoto', false, plugin_basename(HELLO_KUSHIMOTO_DIR) . '/languages'); new Hello_Kushimoto_Dashboard_Widget($speaker); new Hello_Kushimoto_Admin_Notices($speaker); new Hello_Kushimoto_Shortcode($speaker); if (defined('WP_CLI') and WP_CLI) { Hello_Kushimoto_CLI::set_speaker($speaker); WP_CLI::add_command('hello-kushimoto', 'Hello_Kushimoto_CLI'); } }
public function test_invoke() { $speaker = new Miyasan(); Hello_Kushimoto_CLI::set_speaker($speaker); ob_start(); $cli = new Hello_Kushimoto_CLI(); $cli(); $word = trim(ob_get_clean()); $this->assertNotEmpty($word); $words = $speaker->get_words(); $this->assertContains($word, $words); }
/** * @param Hello_Kushimoto_Speaker $speaker */ public static function set_speaker(Hello_Kushimoto_Speaker $speaker) { self::$speaker = $speaker; }