/** * Handle the definition of a suite. * * @access private */ public function onSuiteDefine(Suite $suite) { $definition = new ReflectionFunction($suite->getDefinition()); $parameters = $definition->getParameters(); if ($parameters) { $suite->setDefinitionArguments($this->parameterArguments($parameters)); } }
}); describe('->define()', function () { beforeEach(function () { $this->arg = null; $that = $this; $this->suite = new Suite('argument testing', function ($x) use($that) { $that->arg = $x; }); $this->suite->setEventEmitter($this->eventEmitter); }); it('should call the suite definition with definition arguments', function () { $this->suite->setDefinitionArguments([1]); $this->suite->define(); assert($this->arg === 1, 'should have passed argument'); }); it('should emit a suite.define event', function () { $this->eventEmitter->on('suite.define', function ($suite) { $suite->setDefinitionArguments([1]); }); $this->suite->define(); assert($this->arg === 1, 'should have set definition arguments'); }); }); }); class SuiteScope extends Scope { public function getNumber() { return 5; } }