From d1d2df10560a48724369559b7735de185aba0bdc Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Fri, 8 Jan 2021 20:25:22 +0100 Subject: [PATCH] Add test for additional provided parameters --- tests/DispatcherTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 8b54d06..49699c0 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -72,5 +72,17 @@ public function testCallMethodWithTypeHintWithNamedArgsOnNestedTarget() $this->assertEquals($this->callsOfNestedTarget, [new MethodCall('someMethodWithTypeHint', [new Argument('whatever')])]); } + public function testCallMethodWithAdditionalProvidedParamsOnSomeMethodWithoutArgs() + { + $result = $this->dispatcher->dispatch((string) new Request(1, 'someMethodWithoutArgs', ['arg' => new Argument('whatever')])); + $this->assertEquals('Hello World', $result); + $this->assertEquals($this->calls, [new MethodCall('someMethodWithoutArgs', [])]); + } + public function testCallMethodWithAdditionalProvidedParamsOnSomeMethodWithTypeHint() + { + $result = $this->dispatcher->dispatch((string) new Request(1, 'someMethodWithTypeHint', ['arg' => new Argument('whatever'), 'arg2' => new Argument('anything')])); + $this->assertEquals('Hello World', $result); + $this->assertEquals($this->calls, [new MethodCall('someMethodWithTypeHint', [new Argument('whatever')])]); + } }