The Constructor.
public __construct ( array $config = [] ) | ||
$config | array | The Suite config array. Options are: -`'type'` _string_ : supported type are `'normal'` & `'focus'`. -`'message'` _string_ : the description message. -`'parent'` _object_ : the parent scope. -`'root'` _object_ : the root scope. -`'log'` _object_ : the log instance. -`'timeout'` _integer_: the timeout. |
/** * Constructor. * * @param array $config The Suite config array. Options are: * -`'closure'` _Closure_ : the closure of the test. * -`'scope'` _string_ : supported scope are `'normal'` & `'focus'`. * -`'matcher'` _object_ : the matcher instance. */ public function __construct($config = []) { $defaults = ['closure' => null, 'message' => 'passes', 'scope' => 'normal']; $config += $defaults; $config['message'] = 'it ' . $config['message']; parent::__construct($config); extract($config); $this->_closure = $this->_bind($closure, 'it'); if ($scope === 'focus') { $this->_emitFocus(); } }
/** * Constructor. * * @param array $config The Suite config array. Options are: * -`'closure'` _Closure_ : the closure of the test. * -`'message'` _string_ : the spec message. * -`'scope'` _string_ : supported scope are `'normal'` & `'focus'`. */ public function __construct($config = []) { $defaults = ['closure' => null, 'message' => 'passes']; $config += $defaults; $config['message'] = 'it ' . $config['message']; parent::__construct($config); $config['closure'] = $config['closure'] ?: function () { }; $this->_closure = $this->_bind($config['closure'], 'it'); if ($this->_type === 'focus') { $this->_emitFocus(); } }
/** * The Constructor. * * @param array $config The Suite config array. Options are: * -`'closure'` _Closure_: the closure of the test. * -`'name'` _string_ : the type of the suite. */ public function __construct($config = []) { $defaults = ['closure' => null, 'name' => 'describe']; $config += $defaults; parent::__construct($config); if ($this->_root === $this) { return; } $closure = $this->_bind($config['closure'], $config['name']); $this->_closure = $closure; if ($this->_type === 'focus') { $this->_emitFocus(); } }
/** * The Constructor. * * @param array $config The Suite config array. Options are: * -`'closure'` _Closure_: the closure of the test. * -`'name'` _string_ : the type of the suite. * -`'scope'` _string_ : supported scope are `'normal'` & `'focus'`. */ public function __construct($config = []) { $defaults = ['closure' => null, 'name' => 'describe', 'scope' => 'normal']; $config += $defaults; parent::__construct($config); extract($config); if ($this->_root === $this) { return; } $closure = $this->_bind($closure, $name); $this->_closure = $closure; if ($scope === 'focus') { $this->_emitFocus(); } }