/** * Test that we can query for these tests properly * * @since 1.1.0 * * @group group * @group destination * @group cookie * @group destination_cookie * * @covers \ingot\testing\tests\click\destination\init::get_destination_tests() */ public function testQuery() { ingot_test_data_price::edd_tests(); ingot_tests_data::make_groups(); $x = 0; foreach (\ingot\testing\tests\click\destination\types::destination_types() as $type) { if ('hook' == $type) { continue; } $data = ingot_test_desitnation::create($type); $this->assertTrue(is_numeric($data['group_ID'])); $the_groups[] = $data['group_ID']; $x++; } $groups = \ingot\testing\tests\click\destination\init::get_destination_tests(); $this->assertSame($x, count($groups)); $this->assertEquals($the_groups, $groups); }
/** * Test multiple conversions * * @todo move this test to a better place * * @since 0.4.0 * * @group bandit * @group group * @group front_ui * * @covers ingot_register_conversion() */ public function testMultipleConversions() { $groups = ingot_tests_data::click_link_group(true, 1, 3); $group_id = $groups['ids'][0]; $variants = $groups['variants'][$groups['ids'][0]]; $expected = []; foreach ($variants as $variant) { $expected[$variant] = ['n' => 0, 'd' => 0]; } for ($i = 0; $i <= 25; $i++) { $chosen = $this->check_render($groups); if (in_array($i, [2, 3, 5, 8, 13, 21])) { ingot_register_conversion($chosen); $expected[$chosen]['n'] = $expected[$chosen]['n'] + 1; } $expected[$chosen]['d'] = $expected[$chosen]['d'] + 1; $levers = \ingot\testing\crud\group::get_levers($group_id); /** @var \MaBandit\Lever $lever */ foreach ($levers[$group_id] as $id => $lever) { if ($chosen != $id) { $this->assertSame($expected[$id]['n'], $lever->getNumerator(), $id . '-' . $lever->getNumerator()); $this->assertSame($expected[$id]['d'], $lever->getDenominator(), $id); } } } }
/** * Helper functions for tests * * @package ingot * @author Josh Pollock <*****@*****.**> * @license GPL-2.0+ * @link * @copyright 2015 Josh Pollock */ function ingot_tests_make_groups($add_variants = true, $total_groups = 5, $variants_per_group = 3, $args = array()) { return ingot_tests_data::make_groups($add_variants, $total_groups, $variants_per_group, $args); }