本文整理汇总了PHP中EEM_Event::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Event::reset方法的具体用法?PHP EEM_Event::reset怎么用?PHP EEM_Event::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEM_Event
的用法示例。
在下文中一共展示了EEM_Event::reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_reset_model
/**
* checks that when we reset a model, that it does so properly and
* also returns the NEW model
*/
public function test_reset_model()
{
$model_a = EE_Registry::instance()->load_model('Event');
$model_a2 = EE_Registry::instance()->load_model('Event');
$model_a3 = EEM_Event::instance();
$this->assertEquals($model_a, $model_a2);
$this->assertEquals($model_a2, $model_a3);
$model_b1 = EEM_Event::reset();
$this->assertNotSame($model_a, $model_b1);
$model_b2 = EE_Registry::instance()->reset_model('Event');
$this->assertNotSame($model_a, $model_b2);
}
示例2: test_if_no_meta_row_use_defaults_not_nulls
/**
* Tests that when we get rows from the database and a secondary table has no row,
* but the primary one does, that the fields for the secondary table are given
* DEFAULT values instead of NULLs
* @group 7634
*/
public function test_if_no_meta_row_use_defaults_not_nulls()
{
$e = $this->new_model_obj_with_dependencies('Event');
//now use wpdb to directly delete its meta row
global $wpdb;
$deletions = $wpdb->delete(EEM_Event::instance()->second_table(), array('EVT_ID' => $e->ID()), array('%d'));
$this->assertEquals(1, $deletions);
//now forget about the old event object we had, we want to see what happens when we fetch it again
EEM_Event::reset();
$incomplete_e = EEM_Event::instance()->get_one_by_ID($e->ID());
$actual_row = EEM_Event::instance()->get_all_wpdb_results(array(array('EVT_ID' => $e->ID())));
$a_field_from_meta_table = EEM_Event::instance()->field_settings_for('EVT_display_ticket_selector');
$another_field_from_meta_table = EEM_Event::instance()->field_settings_for('EVT_additional_limit');
$this->assertEquals($a_field_from_meta_table->get_default_value(), $incomplete_e->get('EVT_display_ticket_selector'));
$this->assertTrue(NULL !== $incomplete_e->get('EVT_display_ticket_selector'));
$this->assertEquals($another_field_from_meta_table->get_default_value(), $incomplete_e->get('EVT_additional_limit'));
}
示例3: test_default_reg_status
/**
* @see https://events.codebasehq.com/projects/event-espresso/tickets/8799
* @group 8799
* @since 4.8.8.rc.019
*/
public function test_default_reg_status()
{
//first verify the default reg status on config is pending payment
$this->assertEquals(EEM_Registration::status_id_pending_payment, EE_Registry::instance()->CFG->registration->default_STS_ID);
//verify creating default event from the model has that default reg status
/** @type EE_Event $event */
$event = EEM_Event::instance()->create_default_object();
$this->assertEquals(EEM_Registration::status_id_pending_payment, $event->default_registration_status());
//let's update config in the db to have default reg status of approved
EE_Registry::instance()->CFG->registration->default_STS_ID = EEM_Registration::status_id_approved;
EE_Registry::instance()->CFG->update_espresso_config();
//let's reset for new test
EEM_Event::reset();
EE_Registry::reset();
//k NOW the default reg status in config should be approved
$this->assertEquals(EEM_Registration::status_id_approved, EE_Registry::instance()->CFG->registration->default_STS_ID);
//new default event should have approved as the default reg status
$event = EEM_Event::instance()->create_default_object();
$this->assertEquals(EEM_Registration::status_id_approved, $event->default_registration_status());
}