function test_check_box() { $_ = new Helper(); $event = Test\Event::take(); $this->assertEscapedEquals($_->check_box($event, "show_at_home"), '<input type="hidden" name="event[show_at_home]" value="0" />' . '<input type="checkbox" name="event[show_at_home]" id="event_show_at_home" value="1" />'); $this->assertEscapedEquals($_->check_box($event, "show_at_home", ["checked" => "checked"]), '<input type="hidden" name="event[show_at_home]" value="0" />' . '<input type="checkbox" name="event[show_at_home]" id="event_show_at_home" value="1" checked="checked" />'); $this->assertEscapedEquals($_->check_box($event, "hoge", [], "yes", "no"), '<input type="hidden" name="event[hoge]" value="no" />' . '<input type="checkbox" name="event[hoge]" id="event_hoge" value="yes" checked="checked" />'); $this->assertEscapedEquals($_->check_box($event, "hoge", ["id" => "some-id", "name" => "some-name"], "yes", "no"), '<input type="hidden" name="some-name" value="no" />' . '<input type="checkbox" name="some-name" id="some-id" value="yes" checked="checked" />'); }
<?php require_once '/tmp/wordpress-tests-lib/includes/functions.php'; define("ART_LOGFILE", __DIR__ . "/db.log"); tests_add_filter('after_setup_theme', function () { require dirname(__DIR__) . "/vendor/autoload.php"; Test\Event::initialize(); Test\Info::initialize(); Test\Blog::initialize(); }); require '/tmp/wordpress-tests-lib/includes/bootstrap.php';
function test_simplified_meta_query() { $event = Test\Event::take(); $event->set_meta("hoge", "SIMPLE"); $event = Test\Event::take(["meta_query" => ["key" => "hoge", "value" => "SIMPLE"]]); $this->assertEquals("SIMPLE", $event->hoge); }