diff --git a/src/Parser.php b/src/Parser.php index 7c32e47..ddd307a 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -230,5 +230,4 @@ public function getParsedCommands(): array { return $this->parsedCommands; } - } diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 7d61e85..6327d00 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -69,7 +69,7 @@ public function shouldTransformParamsToBool($params, $expect) $this->assertEquals($expect, $this->parser->getBoolean($params['key'], $params['default'])); } - public function testGetParsedCommands_shouldReturnAnEmptyArrayIfObjectIsFresh() + public function testGetParsedCommandsShouldReturnEmptyArrayOnNewObject() { $parser = new Parser(); $this->assertEmpty( @@ -85,7 +85,7 @@ public function testGetParsedCommands_shouldReturnAnEmptyArrayIfObjectIsFresh() * @param array $params * @param array $expect */ - public function testGetParsedCommands_shouldReturnParsedCommand(array $params, array $expect) + public function testGetParsedCommandsShouldReturnParsedCommand(array $params, array $expect) { $this->parser->parse($params["command"]); $this->assertEquals( @@ -96,7 +96,8 @@ public function testGetParsedCommands_shouldReturnParsedCommand(array $params, a $this->parser->parse(["script-with-no-parameters"]); $this->assertEmpty( $this->parser->getParsedCommands(), - "Parser state should be modified absolutely, if overridden by another parse call." + "Parser state should be modified absolutely, + if overridden by another parse call." ); $this->parser->parse($params["command"]); @@ -114,7 +115,7 @@ public function testGetParsedCommands_shouldReturnParsedCommand(array $params, a * @param array $params * @param array $expect */ - public function testGet_returnsBoundDefaultValueIfValueNotSet(array $params, array $expect) + public function testGetReturnsBoundDefaultValueIfNotSet(array $params, array $expect) { $expectedDefaultValues = [ 123, @@ -123,13 +124,15 @@ public function testGet_returnsBoundDefaultValueIfValueNotSet(array $params, arr true, new stdClass() ]; + $nonExistingParameterKey = "non-existing-parameter-key"; foreach ($expectedDefaultValues as $expectedDefaultValue) { $this->assertEquals( $expectedDefaultValue, $this->parser->get($nonExistingParameterKey, $expectedDefaultValue), - "Should return the provided default value, if the queried parameter doesn't exist in an empty/fresh object." + "Should return the provided default value, + if the queried parameter doesn't exist in an empty/fresh object." ); } @@ -139,7 +142,8 @@ public function testGet_returnsBoundDefaultValueIfValueNotSet(array $params, arr $this->assertEquals( $expectedDefaultValue, $this->parser->get($nonExistingParameterKey, $expectedDefaultValue), - "Should return null, if the queried parameter doesn't exist in a populated/parsed object." + "Should return null, + if the queried parameter doesn't exist in a populated/parsed object." ); } } @@ -151,18 +155,20 @@ public function testGet_returnsBoundDefaultValueIfValueNotSet(array $params, arr * @param array $params * @param array $expect */ - public function testGet_returnsNullIfParamDoesNotExist(array $params, array $expect) + public function testGetReturnsNullIfParamDoesNotExist(array $params, array $expect) { $nonExistingParameterKey = "non-existing-parameter-key"; $this->assertNull( $this->parser->get($nonExistingParameterKey), - "Should return null, if the queried parameter doesn't exist in an empty/fresh object." + "Should return null, + if the queried parameter doesn't exist in an empty/fresh object." ); $this->parser->parse($params["command"]); $this->assertNull( $this->parser->get($nonExistingParameterKey), - "Should return null, if the queried parameter doesn't exist in a populated/parsed object." + "Should return null, + if the queried parameter doesn't exist in a populated/parsed object." ); } @@ -173,7 +179,7 @@ public function testGet_returnsNullIfParamDoesNotExist(array $params, array $exp * @param array $params * @param array $expect */ - public function testGet_returnsValueIfParamDoesExist(array $params, array $expect) + public function testGetReturnsValueIfParamDoesExist(array $params, array $expect) { $this->parser->parse($params["command"]); foreach ($expect as $parameterKey => $expectedValue) {