public function testGetScriptEmpty() { // Arrange $gaRenderer = new GoogleUniversalAnalytics([]); // Act $script = $gaRenderer->getScript(); // Assert $this->assertSame('', $script); }
$filter = new Percentage(50); // And a Variant Chooser $chooser = new RandomChooser(); // Create the Engine $engine = new Engine($manager, $dispatcher, $filter, $chooser); // Create a tests and its variants $test = new Test('foo_test', [], [Google::EXPERIMENT_ID => 'exp1']); $test->addVariant(new SimpleVariant('_control')); $test->addVariant(new SimpleVariant('_variant1')); $test->addVariant(new SimpleVariant('_variant2')); // Create a second test and its variants $test2 = new Test('bar_test', [], [Google::EXPERIMENT_ID => 'exp2']); $test2->addVariant(new SimpleVariant('_control')); $test2->addVariant(new SimpleVariant('_variant1')); $test2->addVariant(new SimpleVariant('_variant2')); // Add the tests to the Engine $engine->addTest($test); $engine->addTest($test2); // Pseudo: if($user->isAdmin) // If the user is admin, he should not participate at the test // $manager->participate('foo_test', null); // Pseudo: if($app->inDevelopment() and $_GET['phpab']['foo_test]) // $manager->participate('foo_test', $_GET['phpab']['foo_test]); // Start testing. Must occur before the EventCycle of the app starts // Start the engine $engine->start(); // Create the Analytics object and pass the Data Collector data to it $analytics = new GoogleUniversalAnalytics($analyticsData->getTestsData()); // Execute the Analytics functionality var_dump($analytics->getScript());