/** * Load the posts2posts from the composer package if it is not loaded already. */ public function require_posts_to_posts() { // Initializes the database tables \P2P_Storage::init(); // Initializes the query mechanism \P2P_Query_Post::init(); }
function _p2p_load() { if (!function_exists('p2p_register_connection_type')) { require_once RTBIZ_PATH . 'vendor/scribu/lib-posts-to-posts/autoload.php'; } P2P_Storage::init(); P2P_Query_Post::init(); P2P_Query_User::init(); P2P_URL_Query::init(); P2P_Widget::init(); P2P_Shortcodes::init(); if (is_admin()) { $this->_load_admin(); } }
function _p2p_load() { load_plugin_textdomain(P2P_TEXTDOMAIN, '', basename(dirname(__FILE__)) . '/lang'); if (!function_exists('p2p_register_connection_type')) { require_once dirname(__FILE__) . '/vendor/scribu/lib-posts-to-posts/autoload.php'; } P2P_Storage::init(); P2P_Query_Post::init(); P2P_Query_User::init(); P2P_URL_Query::init(); P2P_Widget::init(); P2P_Shortcodes::init(); register_uninstall_hook(__FILE__, array('P2P_Storage', 'uninstall')); if (is_admin()) { _p2p_load_admin(); } }
/** * Bring Importer post types into this class. * Runs at import start. */ public function wp_parser_starting_import() { $importer = new Importer(); if (!$this->p2p_tables_exist()) { \P2P_Storage::init(); \P2P_Storage::install(); } $this->post_types = array('hook' => $importer->post_type_hook, 'method' => $importer->post_type_method, 'function' => $importer->post_type_function); }
<?php /** * Test Order * * @package Components\Payments\Tests */ require_once APP_TESTS_LIB . '/testcase.php'; P2P_Storage::init(); P2P_Storage::install(); /** * @group payments */ class APP_OrderTest extends APP_UnitTestCase { protected $order; public static function setUpBeforeClass() { appthemes_setup_orders(); } public function setUp() { parent::setUp(); $user_id = $this->factory->user->create(array('role' => 'subscriber')); wp_set_current_user($user_id); $this->order = APP_Order_Factory::create(); } public function test_retrieve_error() { $this->setExpectedException('PHPUnit_Framework_Error_Warning'); APP_Order_Factory::retrieve('not an id');