/** * Generic getter for groups of both types * * @since 0.2.0 * * @param int $id Group ID * @param string $what Optional. Which type of group. Defaults to click. * * @return array|bool */ public static function group($id, $what = 'click') { if (self::is_price($what)) { return price_group::read($id); } return group::read($id); }
/** * Check price detail util * * @since 0.2.0 * * @covers \ingot\testing\utility\price::price_detail() */ function testPriceDetails() { return; $product_id = 9; $params = array('product_ID' => $product_id, 'default' => rand(-0.9, 0.9)); for ($i = 0; $i <= 3; $i++) { $id = \ingot\testing\crud\price_test::create($params); $tests[$i] = $id; $params['default'] = rand(-0.9, 0.9); } $params = array('type' => 'price', 'plugin' => 'edd', 'group_name' => rand(), 'test_order' => $tests, 'product_ID' => $product_id); $group_id = \ingot\testing\crud\price_group::create($params); $group = \ingot\testing\crud\price_group::read($group_id); $sequence_id = $group['current_sequence']; $test = \ingot\testing\crud\price_test::read($tests[rand(0, 3)]); $details = \ingot\testing\utility\price::price_detail($test, 'a', $sequence_id, $group_id); $this->assertEquals($details['plugin'], $test['plugin']); $this->assertEquals($details['product_ID'], $test['product_ID']); $this->assertEquals($details['test_ID'], $test['ID']); $this->assertEquals($details['sequence_ID'], $sequence_id); $this->assertEquals($details['group_ID'], $group_id); }
/** * Add a test * * @since 0.0.9 * * @access protected * * @param array $sequence */ protected function add_test($sequence) { $a_or_b = $this->a_or_b($sequence, false); $group = price_group::read($sequence['group_ID']); if (is_array($group)) { $test_id = $this->get_test_id($sequence, $a_or_b); $test = test::read($test_id); $test_details = \ingot\testing\utility\price::price_detail($test_id, $a_or_b, $sequence['ID'], $group); $this->price_cookie[$sequence['ID']] = $test_details; } }