Example #1
0
 /**
  * @covers Pachico\Abtest\Engine::getTest
  */
 public function testGetTest()
 {
     $this->assertNull($this->object->getTest('foo'));
     $configurator = new Config\Chainable();
     $configurator->addTest('bar', new Split\ArrayProbability([50, 50]));
     $this->object = new Engine($configurator);
     $retrieved_test = $this->object->getTest('bar');
     $this->assertInstanceOf('Pachico\\Abtest\\Test\\Test', $retrieved_test);
     $this->assertSame('bar', $retrieved_test->getName());
 }
Example #2
0
<?php

/**
 * @author Mariano F.co Benítez Mulet <*****@*****.**>
 * @copyright (c) 2016, Mariano F.co Benítez Mulet
 */
use Pachico\Abtest;
require __DIR__ . '/../vendor/autoload.php';
$configurator = new Abtest\Config\Chainable(new Abtest\Memory\Cookie('ABTESTS', -1), new Abtest\Tracking\GoogleExperiments(true));
$configurator->addTest('colour', new Abtest\Split\ArrayProbability([50, 50]), null, 'colour_tracking_id');
$configurator->addTest('size', new Abtest\Split\ArrayProbability([50, 50]), null, 'size_tracking_id');
$abtest_engine = new Abtest\Engine($configurator);
?>

<html>
	<body style="color: #353535; margin: 30px; font-family: Arial;">
		<h1>Simple test</h1>
		<p>These tests use cookies as Memory. Delete cookies to see these values change.</p>

		<?php 
if ($abtest_engine->getTest('colour')->isParticipant()) {
    ?>

			<h2>I participate in Colour AB test</h2>

			<?php 
    if (0 === $abtest_engine->getTest('colour')->getVersion()) {
        ?>

				<p style="color: black">This is control version (black)</p>
Example #3
0
 /**
  * @covers Pachico\Abtest\Config\Chainable::getConfiguration
  */
 public function testGetConfiguration()
 {
     $this->assertInstanceOf('Pachico\\Abtest\\Config\\Configuration', $this->object->getConfiguration());
 }