/** * Track EDD sale conversions * * @since 1.1.0 * * @group group * @group destination * @group edd * * @covers \ingot\testing\tests\click\destination\hooks::edd_complete_purchase() * @covers \ingot\testing\tests\click\destination\hooks::add_hooks() */ public function testEDDConversionsSale() { if (ingot_is_edd_active()) { $this->assertTrue(\ingot\testing\tests\click\destination\types::allowed_destination_type('sale_edd')); $product = ingot_test_data_price::edd_create_simple_download(10); $data = ingot_test_desitnation::create('sale_edd'); $group_id = $data['group_ID']; $this->assertTrue(is_numeric($group_id)); $variants = $data['variants']; new \ingot\testing\bandit\content($group_id); $variant_id = \ingot\testing\tests\click\destination\init::get_test($group_id); $this->assertTrue(is_numeric($variant_id)); \ingot\testing\tests\click\destination\init::set_tracking(); $this->assertTrue(in_array(\ingot\testing\tests\click\destination\init::get_test($group_id), $variants)); $variant_id = \ingot\testing\tests\click\destination\init::get_test($group_id); $hooks = new \ingot\testing\tests\click\destination\hooks([$group_id]); $payment_id = ingot_test_data_price::edd_create_simple_payment($product); edd_complete_purchase($payment_id, 'publish', 'pending'); $group = \ingot\testing\crud\group::read($group_id); $totals = \ingot\testing\utility\group::get_total($group); $this->assertEquals(3, $totals['total']); $this->assertEquals(2, $totals['conversions']); } }
/** * Check if is a hook test * * @since 1.1.0 * * @param array $group Group config * * @return bool True if is valid group of the destination subtype */ public static function is_hook(array $group) { if ('hook' == \ingot\testing\utility\group::sub_type($group)) { return true; } }
/** * Calculate total number of times this group has been tested * * @access protected * * @since 1.1.0 * * @param array $group Group config * */ protected function calculate_total(array $group) { $this->total = \ingot\testing\utility\group::get_total($group); }