/** * The Constructor. * * @param array $config The options array, possible options are: * - `'closure'`: the closure to execute for this stub. * - `'params'`: the params required for exectuting this stub. * - `'static'`: the type of call required for exectuting this stub. * - `'returns'`: the returns values for this stub (used only if * the `'closure'` option is missing). */ public function __construct($config = []) { $defaults = ['closure' => null, 'params' => [], 'returns' => [], 'static' => false]; $config += $defaults; parent::__construct($config); $this->_closure = $config['closure']; $this->_returns = $config['returns']; }
/** * The Constructor. * * @param array $config The options array, possible options are: * - `'closure'`: the closure to execute for this stub. * - `'args'`: the arguments required for exectuting this stub. * - `'static'`: the type of call required for exectuting this stub. * - `'returns'`: the returns values for this stub (used only if * the `'closure'` option is missing). */ public function __construct($config = []) { $defaults = ['closures' => null, 'args' => [], 'returns' => null, 'static' => false]; $config += $defaults; parent::__construct($config); $this->_name = ltrim($this->_name, '\\'); $this->_closures = $config['closures']; $this->_returns = $config['returns']; }
<?php namespace kahlan\spec\suite\plugin\call; use kahlan\plugin\call\Message; describe("Message", function () { describe("->name()", function () { it("Gets the message name", function () { $message = new Message(['name' => 'message_name']); expect($message->name())->toBe('message_name'); }); }); describe("->params()", function () { it('Gets the message params', function () { $message = new Message(['params' => ['a', 'b', 'c']]); expect($message->params())->toBe(['a', 'b', 'c']); }); }); describe("->isStatic()", function () { it('Checks if the message is static', function () { $message = new Message(['static' => true]); expect($message->isStatic())->toBe(true); $message = new Message(['static' => false]); expect($message->isStatic())->toBe(false); }); }); });