exception(function () { SUT::getInstance(null); }) ->isInstanceOf(LUT\Exception::class); } public function case_get_new_instance() { $this ->when($result = SUT::getInstance('foo')) ->then ->object($result) ->isInstanceOf(SUT::class); } public function case_get_new_instances() { $this ->when($result = SUT::getInstance('foo')) ->then ->object($result) ->isNotIdenticalTo(SUT::getInstance('bar')); } public function case_get_same_instance() { $this ->when($result = SUT::getInstance('foo')) ->then ->object($result) ->isIdenticalTo(SUT::getInstance('foo')); } public function case_get_id() { $this ->given( $id = 'foo', $context = SUT::getInstance($id) ) ->when($result = $context->getId()) ->then ->string($result) ->isEqualTo($id); } public function case_context_exists() { $this ->given( $id = 'foo', SUT::getInstance($id) ) ->when($result = SUT::contextExists($id)) ->then ->boolean($result) ->isTrue(); } public function case_context_does_not_exist() { $this ->when($result = SUT::contextExists('foo')) ->then ->boolean($result) ->isFalse(); } public function case_set_options() { $this ->given( $context = SUT::getInstance('foo'), $options = ['bar' => ['baz' => 'qux']] ) ->when($result = $context->setOptions($options)) ->then ->boolean($result) ->isTrue(); } public function case_get_options() { $this ->given( $context = SUT::getInstance('foo'), $options = ['bar' => ['baz' => 'qux']], $context->setOptions($options) ) ->when($result = $context->getOptions()) ->then ->array($result) ->isEqualTo($options); } public function case_set_parameters() { $this ->given( $context = SUT::getInstance('foo'), $parameters = [ 'notificaion' => 'callback', 'options' => ['bar' => ['baz' => 'qux']] ] ) ->when($result = $context->setParameters($parameters)) ->then ->boolean($result) ->isTrue(); } public function case_get_parameters() { $this ->given( $context = SUT::getInstance('foo'), $parameters = [ 'notification' => 'callback', 'options' => ['bar' => ['baz' => 'qux']] ], $context->setParameters($parameters) ) ->when($result = $context->getParameters()) ->then ->array($result) ->isEqualTo($parameters); } public function case_get_context() { $this ->given($context = SUT::getInstance('foo')) ->when($result = $context->getContext()) ->then ->resource($result) ->isStreamContext(); } }