function testAddForTemplate() { $mb = new CMB_Meta_Box(array('title' => 'Test Meta Box', 'pages' => 'post', 'fields' => array(array('id' => 'test', 'name' => 'Test', 'type' => 'text')), 'show_on' => array('page-template' => 'test.php'))); $this->assertFalse($mb->add_for_page_template(true)); $_GET['post'] = $this->post->ID; $this->assertTrue($mb->add_for_page_template(true)); $_GET['post'] = 3; $this->assertFalse($mb->add_for_page_template(true)); unset($_GET['post']); }