Scientist\Experiment::trial PHP Method

trial() public method

Register a trial callback.
public trial ( string $name, callable $callback )
$name string
$callback callable
    public function trial($name, callable $callback)
    {
        $this->trials[$name] = $callback;
        return $this;
    }

Usage Example

Example #1
0
 public function test_that_intern_can_match_and_mismatch_control_and_trial()
 {
     $i = new Intern();
     $e = new Experiment('test experiment', new Laboratory());
     $e->control(function () {
         return 'foo';
     });
     $e->trial('bar', function () {
         return 'foo';
     });
     $e->trial('baz', function () {
         return 'baz';
     });
     $v = $i->run($e);
     $this->assertInstanceOf('\\Scientist\\Report', $v);
     $this->assertTrue($v->getTrial('bar')->isMatch());
     $this->assertFalse($v->getTrial('baz')->isMatch());
 }
All Usage Examples Of Scientist\Experiment::trial