From 9a3ae590045f44dcb470682e60f15ee063b84bd6 Mon Sep 17 00:00:00 2001 From: Sergei Filatov Date: Thu, 19 Oct 2023 16:54:31 +0300 Subject: [PATCH] initial commit for fork of the Slim framework - fixes in tests - fixes in code --- .phpunit.result.cache | 1 + Slim/App.php | 4 +- Slim/Collection.php | 12 ++-- Slim/Container.php | 10 +-- Slim/Handlers/AbstractError.php | 4 +- Slim/Http/Request.php | 70 ++++++++++---------- Slim/Http/Response.php | 40 +++++------ Slim/Http/Uri.php | 74 ++++++++++----------- composer.json | 9 +-- phpunit.xml | 13 ++++ phpunit.xml.bak | 29 ++++++++ tests/AppTest.php | 62 ++++++++---------- tests/CallableResolverTest.php | 16 ++--- tests/CollectionTest.php | 5 +- tests/ContainerTest.php | 18 ++--- tests/DeferredCallableTest.php | 3 +- tests/Handlers/AbstractHandlerTest.php | 4 +- tests/Handlers/ErrorTest.php | 14 ++-- tests/Handlers/NotAllowedTest.php | 10 +-- tests/Handlers/NotFoundTest.php | 10 +-- tests/Handlers/PhpErrorTest.php | 13 ++-- tests/Http/BodyTest.php | 22 +++---- tests/Http/CookiesTest.php | 6 +- tests/Http/EnvironmentTest.php | 6 +- tests/Http/HeadersTest.php | 4 +- tests/Http/MessageTest.php | 12 ++-- tests/Http/NonBufferedBodyTest.php | 8 +-- tests/Http/RequestBodyTest.php | 22 +++---- tests/Http/RequestTest.php | 35 ++++------ tests/Http/ResponseTest.php | 24 +++---- tests/Http/StreamTest.php | 18 ++--- tests/Http/UploadedFilesTest.php | 19 +++--- tests/Http/UriTest.php | 54 +++++---------- tests/MiddlewareAwareTest.php | 11 ++-- tests/MigratingTestCase.php | 91 ++++++++++++++++++++++++++ tests/RouteTest.php | 11 ++-- tests/RouterTest.php | 44 +++++-------- 37 files changed, 436 insertions(+), 372 deletions(-) create mode 100644 .phpunit.result.cache create mode 100644 phpunit.xml create mode 100644 phpunit.xml.bak create mode 100644 tests/MigratingTestCase.php diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 00000000..5835f41d --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"Slim\\Tests\\AppTest::testContainerInterfaceException":4,"Slim\\Tests\\AppTest::testIssetInContainer":5,"Slim\\Tests\\AppTest::testGetRoute":3,"Slim\\Tests\\AppTest::testPostRoute":3,"Slim\\Tests\\AppTest::testPutRoute":3,"Slim\\Tests\\AppTest::testPatchRoute":3,"Slim\\Tests\\AppTest::testDeleteRoute":3,"Slim\\Tests\\AppTest::testOptionsRoute":3,"Slim\\Tests\\AppTest::testAnyRoute":3,"Slim\\Tests\\AppTest::testMapRoute":3,"Slim\\Tests\\AppTest::testRedirectRoute":3,"Slim\\Tests\\AppTest::testSegmentRouteThatDoesNotEndInASlash":4,"Slim\\Tests\\AppTest::testSegmentRouteThatEndsInASlash":4,"Slim\\Tests\\AppTest::testSegmentRouteThatDoesNotStartWithASlash":4,"Slim\\Tests\\AppTest::testSingleSlashRoute":4,"Slim\\Tests\\AppTest::testEmptyRoute":4,"Slim\\Tests\\AppTest::testGroupSegmentWithSegmentRouteThatDoesNotEndInASlash":4,"Slim\\Tests\\AppTest::testGroupSegmentWithSegmentRouteThatEndsInASlash":4,"Slim\\Tests\\AppTest::testGroupSegmentWithSingleSlashRoute":4,"Slim\\Tests\\AppTest::testGroupSegmentWithEmptyRoute":4,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithSingleSlashRoute":4,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithAnEmptyRoute":4,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithSegmentRoute":4,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithSegmentRouteThatHasATrailingSlash":4,"Slim\\Tests\\AppTest::testGroupSegmentWithSingleSlashNestedGroupAndSegmentRoute":4,"Slim\\Tests\\AppTest::testGroupSegmentWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash":4,"Slim\\Tests\\AppTest::testGroupSegmentWithEmptyNestedGroupAndSegmentRoute":4,"Slim\\Tests\\AppTest::testGroupSegmentWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSegmentRouteThatDoesNotEndInASlash":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSegmentRouteThatEndsInASlash":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSingleSlashRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithEmptyRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithSingleSlashRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithAnEmptyRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithSegmentRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithSegmentRouteThatHasATrailingSlash":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSingleSlashNestedGroupAndSegmentRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithEmptyNestedGroupAndSegmentRoute":4,"Slim\\Tests\\AppTest::testGroupSingleSlashWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash":4,"Slim\\Tests\\AppTest::testEmptyGroupWithSegmentRouteThatDoesNotEndInASlash":4,"Slim\\Tests\\AppTest::testEmptyGroupWithSegmentRouteThatEndsInASlash":4,"Slim\\Tests\\AppTest::testEmptyGroupWithSingleSlashRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithEmptyRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithSingleSlashRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithAnEmptyRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithSegmentRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithSegmentRouteThatHasATrailingSlash":4,"Slim\\Tests\\AppTest::testEmptyGroupWithSingleSlashNestedGroupAndSegmentRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash":4,"Slim\\Tests\\AppTest::testEmptyGroupWithEmptyNestedGroupAndSegmentRoute":4,"Slim\\Tests\\AppTest::testEmptyGroupWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash":4,"Slim\\Tests\\AppTest::testAddMiddlewareOnRoute":4,"Slim\\Tests\\AppTest::testAddMiddlewareOnRouteGroup":4,"Slim\\Tests\\AppTest::testAddMiddlewareOnTwoRouteGroup":4,"Slim\\Tests\\AppTest::testAddMiddlewareOnRouteAndOnTwoRouteGroup":4,"Slim\\Tests\\AppTest::testInvokeReturnMethodNotAllowed":4,"Slim\\Tests\\AppTest::testInvokeWithMatchingRoute":4,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithSetArgument":4,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithSetArguments":4,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithNamedParameter":4,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithNamedParameterRequestResponseArgStrategy":4,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithNamedParameterOverwritesSetArgument":4,"Slim\\Tests\\AppTest::testInvokeWithoutMatchingRoute":4,"Slim\\Tests\\AppTest::testInvokeWithPimpleCallable":4,"Slim\\Tests\\AppTest::testInvokeWithPimpleUndefinedCallable":4,"Slim\\Tests\\AppTest::testInvokeWithPimpleCallableViaMagicMethod":4,"Slim\\Tests\\AppTest::testInvokeFunctionName":4,"Slim\\Tests\\AppTest::testCurrentRequestAttributesAreNotLostWhenAddingRouteArguments":4,"Slim\\Tests\\AppTest::testCurrentRequestAttributesAreNotLostWhenAddingRouteArgumentsRequestResponseArg":4,"Slim\\Tests\\AppTest::testInvokeSubRequest":4,"Slim\\Tests\\AppTest::testInvokeSubRequestWithQuery":4,"Slim\\Tests\\AppTest::testInvokeSubRequestUsesResponseObject":4,"Slim\\Tests\\AppTest::testRun":4,"Slim\\Tests\\AppTest::testRunReturnsEmptyResponseBodyWithHeadRequestMethod":4,"Slim\\Tests\\AppTest::testRunReturnsEmptyResponseBodyWithGetRequestMethodInSilentMode":4,"Slim\\Tests\\AppTest::testRunReturnsEmptyResponseBodyWithHeadRequestMethodInSilentMode":4,"Slim\\Tests\\AppTest::testRespond":4,"Slim\\Tests\\AppTest::testRespondWithHeaderNotSent":4,"Slim\\Tests\\AppTest::testRespondNoContent":4,"Slim\\Tests\\AppTest::testRespondWithPaddedStreamFilterOutput":4,"Slim\\Tests\\AppTest::testRespondIndeterminateLength":4,"Slim\\Tests\\AppTest::testResponseWithStreamReadYieldingLessBytesThanAsked":4,"Slim\\Tests\\AppTest::testResponseReplacesPreviouslySetHeaders":4,"Slim\\Tests\\AppTest::testResponseDoesNotReplacePreviouslySetSetCookieHeaders":4,"Slim\\Tests\\AppTest::testExceptionErrorHandlerDoesNotDisplayErrorDetails":4,"Slim\\Tests\\AppTest::testExceptionPhpErrorHandlerDoesNotDisplayErrorDetails":4,"Slim\\Tests\\AppTest::testRunExceptionNoHandler":3,"Slim\\Tests\\AppTest::testRunSlimException":4,"Slim\\Tests\\AppTest::testRunThrowable":4,"Slim\\Tests\\AppTest::testRunNotFound":4,"Slim\\Tests\\AppTest::testRunNotFoundWithoutHandler":3,"Slim\\Tests\\AppTest::testRunNotAllowed":4,"Slim\\Tests\\AppTest::testRunNotAllowedWithoutHandler":3,"Slim\\Tests\\AppTest::testAppRunWithDetermineRouteBeforeAppMiddleware":4,"Slim\\Tests\\AppTest::testExceptionErrorHandlerDisplaysErrorDetails":4,"Slim\\Tests\\AppTest::testFinalize":4,"Slim\\Tests\\AppTest::testFinalizeWithoutBody":4,"Slim\\Tests\\AppTest::testCallingFromContainerNotCallable":4,"Slim\\Tests\\AppTest::testCallingAnUnknownContainerCallableThrows":4,"Slim\\Tests\\AppTest::testCallingAnUncallableContainerKeyThrows":4,"Slim\\Tests\\AppTest::testOmittingContentLength":4,"Slim\\Tests\\AppTest::testForUnexpectedDataInOutputBuffer":3,"Slim\\Tests\\AppTest::testContainerSetToRoute":4,"Slim\\Tests\\AppTest::testHandlePhpError":1,"Slim\\Tests\\AppTest::testExceptionOutputBufferingOff":4,"Slim\\Tests\\AppTest::testExceptionOutputBufferingAppend":4,"Slim\\Tests\\AppTest::testExceptionOutputBufferingPrepend":4,"Slim\\Tests\\AppTest::testInvokeSequentialProccessToAPathWithOptionalArgsAndWithoutOptionalArgs":4,"Slim\\Tests\\AppTest::testInvokeSequentialProccessToAPathWithOptionalArgsAndWithoutOptionalArgsAndKeepSetedArgs":4,"Slim\\Tests\\AppTest::testInvokeSequentialProccessAfterAddingAnotherRouteArgument":4,"Slim\\Tests\\CallableResolverTest::testMethodNotFoundThrowException":4,"Slim\\Tests\\CallableResolverTest::testFunctionNotFoundThrowException":4,"Slim\\Tests\\CallableResolverTest::testClassNotFoundThrowException":4,"Slim\\Tests\\CallableResolverTest::testCallableClassNotFoundThrowException":4,"Slim\\Tests\\CallableResolverTest::testCallableInvalidTypeThrowException":4,"Slim\\Tests\\ContainerTest::testGetWithValueNotFoundError":4,"Slim\\Tests\\ContainerTest::testGetWithDiConfigErrorThrownAsContainerValueNotFoundException":4,"Slim\\Tests\\ContainerTest::testGetWithDiConfigErrorThrownAsInvalidArgumentException":4,"Slim\\Tests\\ContainerTest::testGetWithErrorThrownByFactoryClosure":4,"Slim\\Tests\\ContainerTest::testGetRequest":4,"Slim\\Tests\\Handlers\\ErrorTest::testNotFoundContentType":4,"Slim\\Tests\\Handlers\\ErrorTest::testRenderHtmlExceptionOrErrorTypeChecksParameter":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testNotFoundContentType":3,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFoundContentType":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testNotFoundContentType":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #0":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #1":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #2":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #3":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #4":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #5":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #0":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #1":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #2":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #3":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #4":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #5":1,"Slim\\Tests\\Handlers\\PhpErrorTest::testNotFoundContentType5":1,"Slim\\Tests\\Http\\BodyTest::testConstructorInvalidStream":4,"Slim\\Tests\\Http\\BodyTest::testGetMetadata":4,"Slim\\Tests\\Http\\BodyTest::testClose":4,"Slim\\Tests\\Http\\BodyTest::testTellDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\BodyTest::testSeekDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\BodyTest::testRewindDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\BodyTest::testReadDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\BodyTest::testWriteDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\BodyTest::testGetContentsDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\CookiesTest::testParseHeaderException":4,"Slim\\Tests\\Http\\HeadersTest::testCreateFromEnvironment":4,"Slim\\Tests\\Http\\HeadersTest::testCreateFromEnvironmentWithSpecialHeaders":4,"Slim\\Tests\\Http\\HeadersTest::testConstructor":4,"Slim\\Tests\\Http\\HeadersTest::testSetSingleValue":4,"Slim\\Tests\\Http\\HeadersTest::testSetArrayValue":4,"Slim\\Tests\\Http\\HeadersTest::testAddNewValue":4,"Slim\\Tests\\Http\\HeadersTest::testAddAnotherValue":4,"Slim\\Tests\\Http\\HeadersTest::testAddArrayValue":4,"Slim\\Tests\\Http\\MessageTest::testWithProtocolVersionInvalidThrowsException":4,"Slim\\Tests\\Http\\RequestBodyTest::testConstructorAttachesStream":4,"Slim\\Tests\\Http\\RequestBodyTest::testConstructorSetsMetadata":4,"Slim\\Tests\\Http\\RequestBodyTest::testGetMetadata":4,"Slim\\Tests\\Http\\RequestBodyTest::testDetach":4,"Slim\\Tests\\Http\\RequestBodyTest::testClose":4,"Slim\\Tests\\Http\\RequestBodyTest::testTellDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\RequestBodyTest::testSeekDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\RequestBodyTest::testRewindDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\RequestBodyTest::testReadDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\RequestBodyTest::testWriteDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\RequestBodyTest::testGetContentsDetachedThrowsRuntimeException":4,"Slim\\Tests\\Http\\RequestTest::testWithMethod":4,"Slim\\Tests\\Http\\RequestTest::testWithAllAllowedCharactersMethod":4,"Slim\\Tests\\Http\\RequestTest::testWithMethodInvalid":4,"Slim\\Tests\\Http\\RequestTest::testWithMethodNull":4,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironment":4,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironmentWithMultipart":4,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironmentWithMultipartMethodOverride":4,"Slim\\Tests\\Http\\RequestTest::testCreateRequestWithInvalidMethodString":4,"Slim\\Tests\\Http\\RequestTest::testCreateRequestWithInvalidMethodOther":4,"Slim\\Tests\\Http\\RequestTest::testIsPost":5,"Slim\\Tests\\Http\\RequestTest::testGetRequestTargetWithSlimPsr7Uri":4,"Slim\\Tests\\Http\\RequestTest::testGetRequestTargetWithNonSlimPsr7Uri":5,"Slim\\Tests\\Http\\RequestTest::testWithRequestTarget":4,"Slim\\Tests\\Http\\RequestTest::testWithRequestTargetThatHasSpaces":4,"Slim\\Tests\\Http\\RequestTest::testWithUri":4,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyAsArray":4,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyReturnsNullWhenThereIsNoBodyData":5,"Slim\\Tests\\Http\\RequestTest::testWithParsedBodyInvalid":4,"Slim\\Tests\\Http\\RequestTest::testWithParsedBodyInvalidFalseValue":4,"Slim\\Tests\\Http\\RequestTest::testGetProtocolVersion":4,"Slim\\Tests\\Http\\ResponseTest::testConstructorWithDefaultArgs":4,"Slim\\Tests\\Http\\ResponseTest::testConstructorWithCustomArgs":4,"Slim\\Tests\\Http\\ResponseTest::testDeepCopyClone":4,"Slim\\Tests\\Http\\ResponseTest::testWithStatus":4,"Slim\\Tests\\Http\\ResponseTest::testWithStatusInvalidStatusCodeThrowsException":4,"Slim\\Tests\\Http\\ResponseTest::testWithStatusInvalidReasonPhraseThrowsException":3,"Slim\\Tests\\Http\\ResponseTest::testMustSetReasonPhraseForUnrecognisedCode":4,"Slim\\Tests\\Http\\ResponseTest::testWithInvalidJsonThrowsException":4,"Slim\\Tests\\Http\\StreamTest::testCannotSeekPipe":4,"Slim\\Tests\\Http\\StreamTest::testCannotTellPipe":4,"Slim\\Tests\\Http\\StreamTest::testCannotRewindPipe":4,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToNotWritable":4,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToCannotBeDoneTwice":4,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToAgain":4,"Slim\\Tests\\Http\\UploadedFilesTest::testMovedStream":4,"Slim\\Tests\\Http\\UriTest::testWithScheme":4,"Slim\\Tests\\Http\\UriTest::testWithSchemeRemovesSuffix":4,"Slim\\Tests\\Http\\UriTest::testWithSchemeEmpty":4,"Slim\\Tests\\Http\\UriTest::testWithSchemeInvalid":4,"Slim\\Tests\\Http\\UriTest::testWithSchemeInvalidType":3,"Slim\\Tests\\Http\\UriTest::testWithUserInfo":4,"Slim\\Tests\\Http\\UriTest::testWithUserInfoEncodesCorrectly":4,"Slim\\Tests\\Http\\UriTest::testWithUserInfoRemovesPassword":4,"Slim\\Tests\\Http\\UriTest::testWithUserInfoRemovesInfo":4,"Slim\\Tests\\Http\\UriTest::testWithHost":4,"Slim\\Tests\\Http\\UriTest::testWithPort":4,"Slim\\Tests\\Http\\UriTest::testWithPortNull":4,"Slim\\Tests\\Http\\UriTest::testWithPortInvalidInt":4,"Slim\\Tests\\Http\\UriTest::testWithPortInvalidString":3,"Slim\\Tests\\Http\\UriTest::testWithBasePath":4,"Slim\\Tests\\Http\\UriTest::testWithBasePathInvalidType":4,"Slim\\Tests\\Http\\UriTest::testWithBasePathAddsPrefix":4,"Slim\\Tests\\Http\\UriTest::testWithBasePathIgnoresSlash":4,"Slim\\Tests\\Http\\UriTest::testWithPath":4,"Slim\\Tests\\Http\\UriTest::testWithPathWithoutPrefix":4,"Slim\\Tests\\Http\\UriTest::testWithPathEmptyValue":4,"Slim\\Tests\\Http\\UriTest::testWithPathUrlEncodesInput":4,"Slim\\Tests\\Http\\UriTest::testWithPathDoesNotDoubleEncodeInput":4,"Slim\\Tests\\Http\\UriTest::testWithPathInvalidType":4,"Slim\\Tests\\Http\\UriTest::testWithQuery":4,"Slim\\Tests\\Http\\UriTest::testWithQueryRemovesPrefix":4,"Slim\\Tests\\Http\\UriTest::testWithQueryEmpty":4,"Slim\\Tests\\Http\\UriTest::testFilterQuery":4,"Slim\\Tests\\Http\\UriTest::testWithQueryInvalidType":4,"Slim\\Tests\\Http\\UriTest::testWithFragment":4,"Slim\\Tests\\Http\\UriTest::testWithFragmentRemovesPrefix":4,"Slim\\Tests\\Http\\UriTest::testWithFragmentEmpty":4,"Slim\\Tests\\Http\\UriTest::testWithFragmentInvalidType":3,"Slim\\Tests\\Http\\UriTest::testToString":4,"Slim\\Tests\\Http\\UriTest::testCreateFromStringWithInvalidType":3,"Slim\\Tests\\Http\\UriTest::testCreateEnvironmentWithBasePath":4,"Slim\\Tests\\Http\\UriTest::testWithPathWhenBaseRootIsEmpty":4,"Slim\\Tests\\Http\\UriTest::testRequestURIContainsIndexDotPhp":4,"Slim\\Tests\\MiddlewareAwareTest::testMiddlewareBadReturnValue":4,"Slim\\Tests\\MiddlewareAwareTest::testAddMiddlewareWhileStackIsRunningThrowException":4,"Slim\\Tests\\MiddlewareAwareTest::testSeedTwiceThrowException":4,"Slim\\Tests\\RouteTest::testConstructor":4,"Slim\\Tests\\RouteTest::testGetCallable":4,"Slim\\Tests\\RouteTest::testSetInvalidName":4,"Slim\\Tests\\RouteTest::testSetInvalidOutputBuffering":4,"Slim\\Tests\\RouteTest::testInvokeWithException":4,"Slim\\Tests\\RouterTest::testMap":3,"Slim\\Tests\\RouterTest::testMapPrependsGroupPattern":4,"Slim\\Tests\\RouterTest::testMapWithInvalidPatternType":4,"Slim\\Tests\\RouterTest::testRelativePathFor":5,"Slim\\Tests\\RouterTest::testGetBasePath":5,"Slim\\Tests\\RouterTest::testPathForWithNoBasePath":5,"Slim\\Tests\\RouterTest::testPathForWithBasePath":5,"Slim\\Tests\\RouterTest::testPathForWithOptionalParameters":5,"Slim\\Tests\\RouterTest::testPathForWithQueryParameters":5,"Slim\\Tests\\RouterTest::testPathForWithNullQueryParameters":5,"Slim\\Tests\\RouterTest::testPathForWithMissingSegmentData":4,"Slim\\Tests\\RouterTest::testPathForRouteNotExists":4,"Slim\\Tests\\RouterTest::testSettingInvalidBasePath":4,"Slim\\Tests\\RouterTest::testCreateDispatcher":5,"Slim\\Tests\\RouterTest::testSetDispatcher":5,"Slim\\Tests\\RouterTest::testRemoveRoute":4,"Slim\\Tests\\RouterTest::testRouteRemovalNotExists":4,"Slim\\Tests\\RouterTest::testPathForWithModifiedRoutePattern":5,"Slim\\Tests\\RouterTest::testSettingCacheFileToFalse":5,"Slim\\Tests\\RouterTest::testSettingInvalidCacheFileValue":4,"Slim\\Tests\\RouterTest::testCacheFileExistsAndIsNotReadable":4,"Slim\\Tests\\RouterTest::testCacheFileDoesNotExistsAndDirectoryIsNotWritable":4,"Slim\\Tests\\RouterTest::testRouteCacheFileCanBeDispatched":5,"Slim\\Tests\\RouterTest::testCreateDispatcherReturnsSameDispatcherASecondTime":5,"Slim\\Tests\\RouterTest::testLookupRouteThrowsExceptionIfRouteNotFound":4,"Slim\\Tests\\RouterTest::testFullUrlFor":5,"Slim\\Tests\\AppTest::testUnsupportedMethodWithoutRoute":4,"Slim\\Tests\\AppTest::testUnsupportedMethodWithRoute":4,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironmentWithMultipartAndQueryParams":3,"Slim\\Tests\\Handlers\\AbstractHandlerTest::testHalfValidContentType":4,"Slim\\Tests\\Handlers\\AbstractHandlerTest::testAcceptableMediaTypeIsNotFirstInList":4,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #0":4,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #1":4,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #2":4,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #3":4,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #4":4,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #5":4,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #0":4,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #1":4,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #2":4,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #3":4,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #4":4,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #5":4,"Slim\\Tests\\Handlers\\ErrorTest::testPreviousException":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #0":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #1":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #2":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #3":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #4":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #5":4,"Slim\\Tests\\Handlers\\NotAllowedTest::testOptions":4,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #0":4,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #1":4,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #2":4,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #3":4,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #4":4,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #5":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #0":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #1":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #2":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #3":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #4":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #5":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #0":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #1":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #2":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #3":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #4":4,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #5":4,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToStream":6},"times":{"Slim\\Tests\\AppTest::testContainerInterfaceException":0.005,"Slim\\Tests\\AppTest::testIssetInContainer":0.002,"Slim\\Tests\\AppTest::testGetRoute":0.001,"Slim\\Tests\\AppTest::testPostRoute":0,"Slim\\Tests\\AppTest::testPutRoute":0,"Slim\\Tests\\AppTest::testPatchRoute":0,"Slim\\Tests\\AppTest::testDeleteRoute":0,"Slim\\Tests\\AppTest::testOptionsRoute":0,"Slim\\Tests\\AppTest::testAnyRoute":0,"Slim\\Tests\\AppTest::testMapRoute":0,"Slim\\Tests\\AppTest::testRedirectRoute":0.012,"Slim\\Tests\\AppTest::testSegmentRouteThatDoesNotEndInASlash":0,"Slim\\Tests\\AppTest::testSegmentRouteThatEndsInASlash":0,"Slim\\Tests\\AppTest::testSegmentRouteThatDoesNotStartWithASlash":0,"Slim\\Tests\\AppTest::testSingleSlashRoute":0,"Slim\\Tests\\AppTest::testEmptyRoute":0,"Slim\\Tests\\AppTest::testGroupSegmentWithSegmentRouteThatDoesNotEndInASlash":0,"Slim\\Tests\\AppTest::testGroupSegmentWithSegmentRouteThatEndsInASlash":0,"Slim\\Tests\\AppTest::testGroupSegmentWithSingleSlashRoute":0,"Slim\\Tests\\AppTest::testGroupSegmentWithEmptyRoute":0,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithSingleSlashRoute":0,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithAnEmptyRoute":0,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithSegmentRoute":0,"Slim\\Tests\\AppTest::testTwoGroupSegmentsWithSegmentRouteThatHasATrailingSlash":0,"Slim\\Tests\\AppTest::testGroupSegmentWithSingleSlashNestedGroupAndSegmentRoute":0,"Slim\\Tests\\AppTest::testGroupSegmentWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash":0,"Slim\\Tests\\AppTest::testGroupSegmentWithEmptyNestedGroupAndSegmentRoute":0,"Slim\\Tests\\AppTest::testGroupSegmentWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSegmentRouteThatDoesNotEndInASlash":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSegmentRouteThatEndsInASlash":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSingleSlashRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithEmptyRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithSingleSlashRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithAnEmptyRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithSegmentRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithNestedGroupSegmentWithSegmentRouteThatHasATrailingSlash":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSingleSlashNestedGroupAndSegmentRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithEmptyNestedGroupAndSegmentRoute":0,"Slim\\Tests\\AppTest::testGroupSingleSlashWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash":0,"Slim\\Tests\\AppTest::testEmptyGroupWithSegmentRouteThatDoesNotEndInASlash":0,"Slim\\Tests\\AppTest::testEmptyGroupWithSegmentRouteThatEndsInASlash":0,"Slim\\Tests\\AppTest::testEmptyGroupWithSingleSlashRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithEmptyRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithSingleSlashRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithAnEmptyRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithSegmentRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithNestedGroupSegmentWithSegmentRouteThatHasATrailingSlash":0,"Slim\\Tests\\AppTest::testEmptyGroupWithSingleSlashNestedGroupAndSegmentRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash":0,"Slim\\Tests\\AppTest::testEmptyGroupWithEmptyNestedGroupAndSegmentRoute":0,"Slim\\Tests\\AppTest::testEmptyGroupWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash":0,"Slim\\Tests\\AppTest::testBottomMiddlewareIsApp":0.001,"Slim\\Tests\\AppTest::testAddMiddleware":0,"Slim\\Tests\\AppTest::testAddMiddlewareOnRoute":0.003,"Slim\\Tests\\AppTest::testAddMiddlewareOnRouteGroup":0,"Slim\\Tests\\AppTest::testAddMiddlewareOnTwoRouteGroup":0,"Slim\\Tests\\AppTest::testAddMiddlewareOnRouteAndOnTwoRouteGroup":0,"Slim\\Tests\\AppTest::testInvokeReturnMethodNotAllowed":0.001,"Slim\\Tests\\AppTest::testInvokeWithMatchingRoute":0,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithSetArgument":0,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithSetArguments":0,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithNamedParameter":0,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithNamedParameterRequestResponseArgStrategy":0,"Slim\\Tests\\AppTest::testInvokeWithMatchingRouteWithNamedParameterOverwritesSetArgument":0,"Slim\\Tests\\AppTest::testInvokeWithoutMatchingRoute":0,"Slim\\Tests\\AppTest::testInvokeWithPimpleCallable":0,"Slim\\Tests\\AppTest::testInvokeWithPimpleUndefinedCallable":0,"Slim\\Tests\\AppTest::testInvokeWithPimpleCallableViaMagicMethod":0,"Slim\\Tests\\AppTest::testInvokeFunctionName":0,"Slim\\Tests\\AppTest::testCurrentRequestAttributesAreNotLostWhenAddingRouteArguments":0,"Slim\\Tests\\AppTest::testCurrentRequestAttributesAreNotLostWhenAddingRouteArgumentsRequestResponseArg":0,"Slim\\Tests\\AppTest::testInvokeSubRequest":0,"Slim\\Tests\\AppTest::testInvokeSubRequestWithQuery":0,"Slim\\Tests\\AppTest::testInvokeSubRequestUsesResponseObject":0,"Slim\\Tests\\AppTest::testRun":0,"Slim\\Tests\\AppTest::testRunReturnsEmptyResponseBodyWithHeadRequestMethod":0,"Slim\\Tests\\AppTest::testRunReturnsEmptyResponseBodyWithGetRequestMethodInSilentMode":0,"Slim\\Tests\\AppTest::testRunReturnsEmptyResponseBodyWithHeadRequestMethodInSilentMode":0,"Slim\\Tests\\AppTest::testRespond":0,"Slim\\Tests\\AppTest::testRespondWithHeaderNotSent":0,"Slim\\Tests\\AppTest::testRespondNoContent":0,"Slim\\Tests\\AppTest::testRespondWithPaddedStreamFilterOutput":0,"Slim\\Tests\\AppTest::testRespondIndeterminateLength":0,"Slim\\Tests\\AppTest::testResponseWithStreamReadYieldingLessBytesThanAsked":0,"Slim\\Tests\\AppTest::testResponseReplacesPreviouslySetHeaders":0,"Slim\\Tests\\AppTest::testResponseDoesNotReplacePreviouslySetSetCookieHeaders":0,"Slim\\Tests\\AppTest::testExceptionErrorHandlerDoesNotDisplayErrorDetails":0.002,"Slim\\Tests\\AppTest::testExceptionPhpErrorHandlerDoesNotDisplayErrorDetails":0.001,"Slim\\Tests\\AppTest::testRunExceptionNoHandler":0,"Slim\\Tests\\AppTest::testRunSlimException":0,"Slim\\Tests\\AppTest::testRunThrowable":0,"Slim\\Tests\\AppTest::testRunNotFound":0,"Slim\\Tests\\AppTest::testRunNotFoundWithoutHandler":0,"Slim\\Tests\\AppTest::testRunNotAllowed":0,"Slim\\Tests\\AppTest::testRunNotAllowedWithoutHandler":0,"Slim\\Tests\\AppTest::testAppRunWithDetermineRouteBeforeAppMiddleware":0,"Slim\\Tests\\AppTest::testExceptionErrorHandlerDisplaysErrorDetails":0,"Slim\\Tests\\AppTest::testFinalize":0,"Slim\\Tests\\AppTest::testFinalizeWithoutBody":0,"Slim\\Tests\\AppTest::testCallingAContainerCallable":0,"Slim\\Tests\\AppTest::testCallingFromContainerNotCallable":0,"Slim\\Tests\\AppTest::testCallingAnUnknownContainerCallableThrows":0,"Slim\\Tests\\AppTest::testCallingAnUncallableContainerKeyThrows":0,"Slim\\Tests\\AppTest::testOmittingContentLength":0,"Slim\\Tests\\AppTest::testForUnexpectedDataInOutputBuffer":0,"Slim\\Tests\\AppTest::testUnsupportedMethodWithoutRoute":0,"Slim\\Tests\\AppTest::testUnsupportedMethodWithRoute":0,"Slim\\Tests\\AppTest::testContainerSetToRoute":0,"Slim\\Tests\\AppTest::testIsEmptyResponseWithEmptyMethod":0,"Slim\\Tests\\AppTest::testIsEmptyResponseWithoutEmptyMethod":0,"Slim\\Tests\\AppTest::testIsHeadRequestWithGetRequest":0,"Slim\\Tests\\AppTest::testIsHeadRequestWithHeadRequest":0,"Slim\\Tests\\AppTest::testHandlePhpError":0,"Slim\\Tests\\AppTest::testExceptionOutputBufferingOff":0,"Slim\\Tests\\AppTest::testExceptionOutputBufferingAppend":0,"Slim\\Tests\\AppTest::testExceptionOutputBufferingPrepend":0.001,"Slim\\Tests\\AppTest::testInvokeSequentialProccessToAPathWithOptionalArgsAndWithoutOptionalArgs":0,"Slim\\Tests\\AppTest::testInvokeSequentialProccessToAPathWithOptionalArgsAndWithoutOptionalArgsAndKeepSetedArgs":0,"Slim\\Tests\\AppTest::testInvokeSequentialProccessAfterAddingAnotherRouteArgument":0,"Slim\\Tests\\CallableResolverTest::testClosure":0,"Slim\\Tests\\CallableResolverTest::testFunctionName":0,"Slim\\Tests\\CallableResolverTest::testObjMethodArray":0,"Slim\\Tests\\CallableResolverTest::testSlimCallable":0,"Slim\\Tests\\CallableResolverTest::testSlimCallableContainer":0,"Slim\\Tests\\CallableResolverTest::testContainer":0,"Slim\\Tests\\CallableResolverTest::testResolutionToAnInvokableClassInContainer":0,"Slim\\Tests\\CallableResolverTest::testResolutionToAnInvokableClass":0,"Slim\\Tests\\CallableResolverTest::testMethodNotFoundThrowException":0,"Slim\\Tests\\CallableResolverTest::testFunctionNotFoundThrowException":0,"Slim\\Tests\\CallableResolverTest::testClassNotFoundThrowException":0,"Slim\\Tests\\CallableResolverTest::testCallableClassNotFoundThrowException":0,"Slim\\Tests\\CallableResolverTest::testCallableInvalidTypeThrowException":0,"Slim\\Tests\\CollectionTest::testInitializeWithData":0,"Slim\\Tests\\CollectionTest::testSet":0,"Slim\\Tests\\CollectionTest::testOffsetSet":0,"Slim\\Tests\\CollectionTest::testGet":0,"Slim\\Tests\\CollectionTest::testGetWithDefault":0,"Slim\\Tests\\CollectionTest::testReplace":0,"Slim\\Tests\\CollectionTest::testAll":0,"Slim\\Tests\\CollectionTest::testKeys":0,"Slim\\Tests\\CollectionTest::testHas":0,"Slim\\Tests\\CollectionTest::testOffsetExists":0,"Slim\\Tests\\CollectionTest::testRemove":0,"Slim\\Tests\\CollectionTest::testOffsetUnset":0,"Slim\\Tests\\CollectionTest::testClear":0,"Slim\\Tests\\CollectionTest::testCount":0,"Slim\\Tests\\ContainerTest::testGet":0,"Slim\\Tests\\ContainerTest::testGetWithValueNotFoundError":0.001,"Slim\\Tests\\ContainerTest::testGetWithDiConfigErrorThrownAsContainerValueNotFoundException":0,"Slim\\Tests\\ContainerTest::testGetWithDiConfigErrorThrownAsInvalidArgumentException":0,"Slim\\Tests\\ContainerTest::testGetWithErrorThrownByFactoryClosure":0,"Slim\\Tests\\ContainerTest::testGetRequest":0,"Slim\\Tests\\ContainerTest::testGetResponse":0,"Slim\\Tests\\ContainerTest::testGetRouter":0,"Slim\\Tests\\ContainerTest::testGetErrorHandler":0,"Slim\\Tests\\ContainerTest::testGetNotAllowedHandler":0,"Slim\\Tests\\ContainerTest::testSettingsCanBeEdited":0,"Slim\\Tests\\ContainerTest::testMagicIssetMethod":0,"Slim\\Tests\\ContainerTest::testMagicGetMethod":0,"Slim\\Tests\\ContainerTest::testRouteCacheDisabledByDefault":0,"Slim\\Tests\\DeferredCallableTest::testItResolvesCallable":0,"Slim\\Tests\\DeferredCallableTest::testItBindsClosuresToContainer":0,"Slim\\Tests\\DeferredCallableTest::testItReturnsInvokedCallableResponse":0,"Slim\\Tests\\DeferredCallableTest::testGetCallable":0,"Slim\\Tests\\Handlers\\AbstractHandlerTest::testHalfValidContentType":0.003,"Slim\\Tests\\Handlers\\AbstractHandlerTest::testAcceptableMediaTypeIsNotFirstInList":0,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #0":0,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #1":0,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #2":0,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #3":0,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #4":0,"Slim\\Tests\\Handlers\\ErrorTest::testError with data set #5":0,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #0":0,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #1":0,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #2":0,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #3":0,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #4":0,"Slim\\Tests\\Handlers\\ErrorTest::testErrorDisplayDetails with data set #5":0,"Slim\\Tests\\Handlers\\ErrorTest::testNotFoundContentType":0,"Slim\\Tests\\Handlers\\ErrorTest::testPreviousException":0.001,"Slim\\Tests\\Handlers\\ErrorTest::testRenderHtmlExceptionOrErrorTypeChecksParameter":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #0":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #1":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #2":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #3":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #4":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testInvalidMethod with data set #5":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testOptions":0,"Slim\\Tests\\Handlers\\NotAllowedTest::testNotFoundContentType":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #0":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #1":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #2":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #3":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #4":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFound with data set #5":0,"Slim\\Tests\\Handlers\\NotFoundTest::testNotFoundContentType":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #0":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #1":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #2":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #3":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #4":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError with data set #5":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #0":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #1":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #2":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #3":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #4":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails with data set #5":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testNotFoundContentType":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #0":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #1":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #2":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #3":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #4":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpError5 with data set #5":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #0":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #1":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #2":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #3":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #4":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testPhpErrorDisplayDetails5 with data set #5":0,"Slim\\Tests\\Handlers\\PhpErrorTest::testNotFoundContentType5":0,"Slim\\Tests\\Http\\BodyTest::testConstructorAttachesStream":0,"Slim\\Tests\\Http\\BodyTest::testConstructorInvalidStream":0,"Slim\\Tests\\Http\\BodyTest::testGetMetadata":0,"Slim\\Tests\\Http\\BodyTest::testGetMetadataKey":0,"Slim\\Tests\\Http\\BodyTest::testGetMetadataKeyNotFound":0,"Slim\\Tests\\Http\\BodyTest::testDetach":0,"Slim\\Tests\\Http\\BodyTest::testToStringAttached":0,"Slim\\Tests\\Http\\BodyTest::testToStringAttachedRewindsFirst":0,"Slim\\Tests\\Http\\BodyTest::testToStringDetached":0,"Slim\\Tests\\Http\\BodyTest::testClose":0,"Slim\\Tests\\Http\\BodyTest::testGetSizeAttached":0,"Slim\\Tests\\Http\\BodyTest::testGetSizeDetached":0,"Slim\\Tests\\Http\\BodyTest::testTellAttached":0,"Slim\\Tests\\Http\\BodyTest::testTellDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\BodyTest::testEofAttachedFalse":0,"Slim\\Tests\\Http\\BodyTest::testEofAttachedTrue":0,"Slim\\Tests\\Http\\BodyTest::testEofDetached":0,"Slim\\Tests\\Http\\BodyTest::testIsReadableDetached":0,"Slim\\Tests\\Http\\BodyTest::testIsWritableDetached":0,"Slim\\Tests\\Http\\BodyTest::testIsSeekableDetached":0,"Slim\\Tests\\Http\\BodyTest::testSeekAttached":0,"Slim\\Tests\\Http\\BodyTest::testSeekDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\BodyTest::testRewindAttached":0,"Slim\\Tests\\Http\\BodyTest::testRewindDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\BodyTest::testReadAttached":0,"Slim\\Tests\\Http\\BodyTest::testReadDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\BodyTest::testWriteAttached":0,"Slim\\Tests\\Http\\BodyTest::testWriteDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\BodyTest::testGetContentsAttached":0,"Slim\\Tests\\Http\\BodyTest::testGetContentsDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\CookiesTest::testConstructor":0,"Slim\\Tests\\Http\\CookiesTest::testSetDefaults":0,"Slim\\Tests\\Http\\CookiesTest::testSetCookieValues":0,"Slim\\Tests\\Http\\CookiesTest::testSetCookieValuesContainDefaults":0,"Slim\\Tests\\Http\\CookiesTest::testSetCookieValuesCanOverrideDefaults":0,"Slim\\Tests\\Http\\CookiesTest::testSetSameSiteCookieValuesAreCaseInsensitive":0,"Slim\\Tests\\Http\\CookiesTest::testGet":0,"Slim\\Tests\\Http\\CookiesTest::testParseHeader":0,"Slim\\Tests\\Http\\CookiesTest::testParseHeaderWithJsonArray":0,"Slim\\Tests\\Http\\CookiesTest::testToHeaders":0,"Slim\\Tests\\Http\\CookiesTest::testToHeader":0.001,"Slim\\Tests\\Http\\CookiesTest::testParseHeaderException":0,"Slim\\Tests\\Http\\EnvironmentTest::testEnvironmentFromGlobals":0,"Slim\\Tests\\Http\\EnvironmentTest::testMock":0,"Slim\\Tests\\Http\\EnvironmentTest::testMockHttps":0,"Slim\\Tests\\Http\\EnvironmentTest::testMockRequestScheme":0,"Slim\\Tests\\Http\\HeadersTest::testCreateFromEnvironment":0,"Slim\\Tests\\Http\\HeadersTest::testCreateFromEnvironmentWithSpecialHeaders":0,"Slim\\Tests\\Http\\HeadersTest::testCreateFromEnvironmentIgnoresHeaders":0,"Slim\\Tests\\Http\\HeadersTest::testConstructor":0,"Slim\\Tests\\Http\\HeadersTest::testSetSingleValue":0,"Slim\\Tests\\Http\\HeadersTest::testSetArrayValue":0,"Slim\\Tests\\Http\\HeadersTest::testGet":0,"Slim\\Tests\\Http\\HeadersTest::testGetOriginalKey":0,"Slim\\Tests\\Http\\HeadersTest::testGetNotExists":0,"Slim\\Tests\\Http\\HeadersTest::testAddNewValue":0,"Slim\\Tests\\Http\\HeadersTest::testAddAnotherValue":0,"Slim\\Tests\\Http\\HeadersTest::testAddArrayValue":0,"Slim\\Tests\\Http\\HeadersTest::testHas":0,"Slim\\Tests\\Http\\HeadersTest::testRemove":0,"Slim\\Tests\\Http\\HeadersTest::testOriginalKeys":0,"Slim\\Tests\\Http\\HeadersTest::testNormalizeKey":0,"Slim\\Tests\\Http\\HeadersTest::testDetermineAuthorization":0,"Slim\\Tests\\Http\\HeadersTest::testDetermineAuthorizationReturnsEarlyIfHeadersIsNotArray":0,"Slim\\Tests\\Http\\MessageTest::testGetProtocolVersion":0,"Slim\\Tests\\Http\\MessageTest::testWithProtocolVersion":0,"Slim\\Tests\\Http\\MessageTest::testWithProtocolVersionInvalidThrowsException":0,"Slim\\Tests\\Http\\MessageTest::testWithProtocolVersionForHttp2":0,"Slim\\Tests\\Http\\MessageTest::testGetHeaders":0,"Slim\\Tests\\Http\\MessageTest::testHasHeader":0,"Slim\\Tests\\Http\\MessageTest::testGetHeaderLine":0,"Slim\\Tests\\Http\\MessageTest::testGetHeader":0,"Slim\\Tests\\Http\\MessageTest::testWithHeader":0,"Slim\\Tests\\Http\\MessageTest::testWithAddedHeader":0,"Slim\\Tests\\Http\\MessageTest::testWithoutHeader":0,"Slim\\Tests\\Http\\MessageTest::testGetBody":0,"Slim\\Tests\\Http\\MessageTest::testWithBody":0,"Slim\\Tests\\Http\\NonBufferedBodyTest::testTheStreamContract":0,"Slim\\Tests\\Http\\NonBufferedBodyTest::testWrite":0,"Slim\\Tests\\Http\\NonBufferedBodyTest::testWithHeader":0,"Slim\\Tests\\Http\\NonBufferedBodyTest::testWithAddedHeader":0,"Slim\\Tests\\Http\\NonBufferedBodyTest::testWithoutHeader":0,"Slim\\Tests\\Http\\RequestBodyTest::testConstructorAttachesStream":0,"Slim\\Tests\\Http\\RequestBodyTest::testConstructorSetsMetadata":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetMetadata":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetMetadataKey":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetMetadataKeyNotFound":0,"Slim\\Tests\\Http\\RequestBodyTest::testDetach":0,"Slim\\Tests\\Http\\RequestBodyTest::testToStringAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testToStringAttachedRewindsFirst":0,"Slim\\Tests\\Http\\RequestBodyTest::testToStringDetached":0,"Slim\\Tests\\Http\\RequestBodyTest::testClose":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetSizeAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetSizeDetached":0,"Slim\\Tests\\Http\\RequestBodyTest::testTellAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testTellDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\RequestBodyTest::testEofAttachedFalse":0,"Slim\\Tests\\Http\\RequestBodyTest::testEofAttachedTrue":0,"Slim\\Tests\\Http\\RequestBodyTest::testEofDetached":0,"Slim\\Tests\\Http\\RequestBodyTest::testIsReadableAttachedTrue":0,"Slim\\Tests\\Http\\RequestBodyTest::testIsReadableDetached":0,"Slim\\Tests\\Http\\RequestBodyTest::testIsWritableAttachedTrue":0,"Slim\\Tests\\Http\\RequestBodyTest::testIsWritableDetached":0,"Slim\\Tests\\Http\\RequestBodyTest::testIsSeekableDetached":0,"Slim\\Tests\\Http\\RequestBodyTest::testSeekAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testSeekDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\RequestBodyTest::testRewindAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testRewindDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\RequestBodyTest::testReadAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testReadDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\RequestBodyTest::testWriteAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testWriteDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetContentsAttached":0,"Slim\\Tests\\Http\\RequestBodyTest::testGetContentsDetachedThrowsRuntimeException":0,"Slim\\Tests\\Http\\RequestTest::testDisableSetter":0,"Slim\\Tests\\Http\\RequestTest::testDoesNotAddHostHeaderFromUriIfAlreadySet":0,"Slim\\Tests\\Http\\RequestTest::testAddsHostHeaderFromUriIfNotSet":0,"Slim\\Tests\\Http\\RequestTest::testAddsPortToHostHeaderIfSetWhenHostHeaderIsMissingFromRequest":0,"Slim\\Tests\\Http\\RequestTest::testDoesntAddHostHeaderFromUriIfNeitherAreSet":0,"Slim\\Tests\\Http\\RequestTest::testGetMethod":0,"Slim\\Tests\\Http\\RequestTest::testGetOriginalMethod":0,"Slim\\Tests\\Http\\RequestTest::testWithMethod":0,"Slim\\Tests\\Http\\RequestTest::testWithAllAllowedCharactersMethod":0,"Slim\\Tests\\Http\\RequestTest::testWithMethodInvalid":0,"Slim\\Tests\\Http\\RequestTest::testWithMethodNull":0,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironment":0,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironmentWithMultipart":0,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironmentWithMultipartAndQueryParams":0,"Slim\\Tests\\Http\\RequestTest::testCreateFromEnvironmentWithMultipartMethodOverride":0,"Slim\\Tests\\Http\\RequestTest::testGetMethodWithOverrideHeader":0,"Slim\\Tests\\Http\\RequestTest::testGetMethodWithOverrideParameterFromBodyObject":0,"Slim\\Tests\\Http\\RequestTest::testGetMethodOverrideParameterFromBodyArray":0,"Slim\\Tests\\Http\\RequestTest::testCreateRequestWithInvalidMethodString":0,"Slim\\Tests\\Http\\RequestTest::testCreateRequestWithInvalidMethodOther":0,"Slim\\Tests\\Http\\RequestTest::testIsGet":0,"Slim\\Tests\\Http\\RequestTest::testIsPost":0,"Slim\\Tests\\Http\\RequestTest::testIsPut":0,"Slim\\Tests\\Http\\RequestTest::testIsPatch":0,"Slim\\Tests\\Http\\RequestTest::testIsDelete":0,"Slim\\Tests\\Http\\RequestTest::testIsHead":0,"Slim\\Tests\\Http\\RequestTest::testIsOptions":0,"Slim\\Tests\\Http\\RequestTest::testIsXhr":0,"Slim\\Tests\\Http\\RequestTest::testGetRequestTarget":0,"Slim\\Tests\\Http\\RequestTest::testGetRequestTargetAlreadySet":0,"Slim\\Tests\\Http\\RequestTest::testGetRequestTargetIfNoUri":0,"Slim\\Tests\\Http\\RequestTest::testGetRequestTargetWithSlimPsr7Uri":0.016,"Slim\\Tests\\Http\\RequestTest::testGetRequestTargetWithNonSlimPsr7Uri":0,"Slim\\Tests\\Http\\RequestTest::testWithRequestTarget":0,"Slim\\Tests\\Http\\RequestTest::testWithRequestTargetThatHasSpaces":0,"Slim\\Tests\\Http\\RequestTest::testGetUri":0,"Slim\\Tests\\Http\\RequestTest::testWithUri":0,"Slim\\Tests\\Http\\RequestTest::testWithUriPreservesHost":0,"Slim\\Tests\\Http\\RequestTest::testGetContentType":0,"Slim\\Tests\\Http\\RequestTest::testGetContentTypeEmpty":0,"Slim\\Tests\\Http\\RequestTest::testGetMediaType":0,"Slim\\Tests\\Http\\RequestTest::testGetMediaTypeEmpty":0,"Slim\\Tests\\Http\\RequestTest::testGetMediaTypeParams":0,"Slim\\Tests\\Http\\RequestTest::testGetMediaTypeParamsEmpty":0,"Slim\\Tests\\Http\\RequestTest::testGetMediaTypeParamsWithoutHeader":0,"Slim\\Tests\\Http\\RequestTest::testGetContentCharset":0,"Slim\\Tests\\Http\\RequestTest::testGetContentCharsetEmpty":0,"Slim\\Tests\\Http\\RequestTest::testGetContentCharsetWithoutHeader":0,"Slim\\Tests\\Http\\RequestTest::testGetContentLength":0,"Slim\\Tests\\Http\\RequestTest::testGetContentLengthWithoutHeader":0,"Slim\\Tests\\Http\\RequestTest::testGetCookieParam":0,"Slim\\Tests\\Http\\RequestTest::testGetCookieParamWithDefault":0,"Slim\\Tests\\Http\\RequestTest::testGetCookieParams":0,"Slim\\Tests\\Http\\RequestTest::testWithCookieParams":0,"Slim\\Tests\\Http\\RequestTest::testGetQueryParams":0,"Slim\\Tests\\Http\\RequestTest::testGetQueryParamsAlreadySet":0,"Slim\\Tests\\Http\\RequestTest::testWithQueryParams":0,"Slim\\Tests\\Http\\RequestTest::testWithQueryParamsEmptyArray":0,"Slim\\Tests\\Http\\RequestTest::testGetQueryParamsWithoutUri":0,"Slim\\Tests\\Http\\RequestTest::testWithUploadedFiles":0,"Slim\\Tests\\Http\\RequestTest::testGetServerParams":0,"Slim\\Tests\\Http\\RequestTest::testGetServerParam":0,"Slim\\Tests\\Http\\RequestTest::testGetServerParamWithDefault":0,"Slim\\Tests\\Http\\RequestTest::testGetAttributes":0,"Slim\\Tests\\Http\\RequestTest::testGetAttribute":0,"Slim\\Tests\\Http\\RequestTest::testWithAttribute":0,"Slim\\Tests\\Http\\RequestTest::testWithAttributes":0,"Slim\\Tests\\Http\\RequestTest::testWithoutAttribute":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyForm":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyJson":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyInvalidJson":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodySemiValidJson":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyWithJsonStructuredSuffix":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyWithJsonStructuredSuffixAndRegisteredParser":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyXml":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyWithXmlStructuredSuffix":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyXmlWithTextXMLMediaType":0,"Slim\\Tests\\Http\\RequestTest::testInvalidXmlIsQuietForTextXml":0,"Slim\\Tests\\Http\\RequestTest::testInvalidXmlIsQuietForApplicationXml":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyWhenAlreadyParsed":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyWhenBodyDoesNotExist":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyAfterCallReparseBody":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyAsArray":0,"Slim\\Tests\\Http\\RequestTest::testWithParsedBody":0,"Slim\\Tests\\Http\\RequestTest::testWithParsedBodyEmptyArray":0,"Slim\\Tests\\Http\\RequestTest::testWithParsedBodyNull":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyReturnsNullWhenThereIsNoBodyData":0,"Slim\\Tests\\Http\\RequestTest::testGetParsedBodyReturnsNullWhenThereIsNoMediaTypeParserRegistered":0,"Slim\\Tests\\Http\\RequestTest::testWithParsedBodyInvalid":0,"Slim\\Tests\\Http\\RequestTest::testWithParsedBodyInvalidFalseValue":0,"Slim\\Tests\\Http\\RequestTest::testGetParameterFromBody":0,"Slim\\Tests\\Http\\RequestTest::testGetParameterFromBodyWithBodyParemeterHelper":0,"Slim\\Tests\\Http\\RequestTest::testGetParameterFromQuery":0,"Slim\\Tests\\Http\\RequestTest::testGetParameterFromQueryWithQueryParemeterHelper":0,"Slim\\Tests\\Http\\RequestTest::testGetParameterFromBodyOverQuery":0,"Slim\\Tests\\Http\\RequestTest::testGetParameterWithDefaultFromBodyOverQuery":0,"Slim\\Tests\\Http\\RequestTest::testGetParameters":0,"Slim\\Tests\\Http\\RequestTest::testGetParametersWithBodyPriority":0,"Slim\\Tests\\Http\\RequestTest::testGetParametersWithSpecificKeys":0,"Slim\\Tests\\Http\\RequestTest::testGetParametersWithSpecificKeysAreMissingIfTheyDontExit":0,"Slim\\Tests\\Http\\RequestTest::testGetProtocolVersion":0,"Slim\\Tests\\Http\\ResponseTest::testConstructorWithDefaultArgs":0,"Slim\\Tests\\Http\\ResponseTest::testConstructorWithCustomArgs":0,"Slim\\Tests\\Http\\ResponseTest::testDeepCopyClone":0,"Slim\\Tests\\Http\\ResponseTest::testDisableSetter":0,"Slim\\Tests\\Http\\ResponseTest::testGetStatusCode":0,"Slim\\Tests\\Http\\ResponseTest::testWithStatus":0,"Slim\\Tests\\Http\\ResponseTest::testWithStatusInvalidStatusCodeThrowsException":0,"Slim\\Tests\\Http\\ResponseTest::testWithStatusInvalidReasonPhraseThrowsException":0,"Slim\\Tests\\Http\\ResponseTest::testWithStatusEmptyReasonPhrase":0,"Slim\\Tests\\Http\\ResponseTest::testGetReasonPhrase":0,"Slim\\Tests\\Http\\ResponseTest::testMustSetReasonPhraseForUnrecognisedCode":0,"Slim\\Tests\\Http\\ResponseTest::testSetReasonPhraseForUnrecognisedCode":0,"Slim\\Tests\\Http\\ResponseTest::testGetCustomReasonPhrase":0,"Slim\\Tests\\Http\\ResponseTest::testWithRedirect":0,"Slim\\Tests\\Http\\ResponseTest::testIsEmpty":0,"Slim\\Tests\\Http\\ResponseTest::testIsInformational":0,"Slim\\Tests\\Http\\ResponseTest::testIsOk":0,"Slim\\Tests\\Http\\ResponseTest::testIsSuccessful":0,"Slim\\Tests\\Http\\ResponseTest::testIsRedirect":0,"Slim\\Tests\\Http\\ResponseTest::testIsRedirection":0,"Slim\\Tests\\Http\\ResponseTest::testIsForbidden":0,"Slim\\Tests\\Http\\ResponseTest::testIsNotFound":0,"Slim\\Tests\\Http\\ResponseTest::testIsBadRequest":0,"Slim\\Tests\\Http\\ResponseTest::testIsClientError":0,"Slim\\Tests\\Http\\ResponseTest::testIsServerError":0,"Slim\\Tests\\Http\\ResponseTest::testToString":0,"Slim\\Tests\\Http\\ResponseTest::testWithJson":0,"Slim\\Tests\\Http\\ResponseTest::testWithInvalidJsonThrowsException":0,"Slim\\Tests\\Http\\ResponseTest::testStatusIsSetTo302IfLocationIsSetWhenStatusis200":0,"Slim\\Tests\\Http\\ResponseTest::testStatusIsNotSetTo302IfLocationIsSetWhenStatusisNot200":0,"Slim\\Tests\\Http\\StreamTest::testIsPipe":0.003,"Slim\\Tests\\Http\\StreamTest::testIsPipeReadable":0.003,"Slim\\Tests\\Http\\StreamTest::testPipeIsNotSeekable":0.004,"Slim\\Tests\\Http\\StreamTest::testCannotSeekPipe":0.003,"Slim\\Tests\\Http\\StreamTest::testCannotTellPipe":0.003,"Slim\\Tests\\Http\\StreamTest::testCannotRewindPipe":0.003,"Slim\\Tests\\Http\\StreamTest::testPipeGetSizeYieldsNull":0.003,"Slim\\Tests\\Http\\StreamTest::testClosePipe":0.003,"Slim\\Tests\\Http\\StreamTest::testPipeToString":0.003,"Slim\\Tests\\Http\\StreamTest::testPipeGetContents":0.003,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromFilesSuperglobal with data set #0":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromFilesSuperglobal with data set #1":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromFilesSuperglobal with data set #2":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromFilesSuperglobal with data set #3":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromFilesSuperglobal with data set #4":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromFilesSuperglobal with data set #5":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromUserData with data set #0":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromUserData with data set #1":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromUserData with data set #2":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromUserData with data set #3":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromUserData with data set #4":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentFromUserData with data set #5":0,"Slim\\Tests\\Http\\UploadedFilesTest::testCreateFromEnvironmentWithoutFile":0,"Slim\\Tests\\Http\\UploadedFilesTest::testConstructor":0,"Slim\\Tests\\Http\\UploadedFilesTest::testGetStream":0,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToNotWritable":0,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveTo":0.001,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToCannotBeDoneTwice":0,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToAgain":0,"Slim\\Tests\\Http\\UploadedFilesTest::testMovedStream":0,"Slim\\Tests\\Http\\UploadedFilesTest::testMoveToStream":0,"Slim\\Tests\\Http\\UriTest::testGetScheme":0,"Slim\\Tests\\Http\\UriTest::testWithScheme":0,"Slim\\Tests\\Http\\UriTest::testWithSchemeRemovesSuffix":0,"Slim\\Tests\\Http\\UriTest::testWithSchemeEmpty":0,"Slim\\Tests\\Http\\UriTest::testWithSchemeInvalid":0,"Slim\\Tests\\Http\\UriTest::testWithSchemeInvalidType":0,"Slim\\Tests\\Http\\UriTest::testGetAuthorityWithUsernameAndPassword":0,"Slim\\Tests\\Http\\UriTest::testGetAuthorityWithUsername":0,"Slim\\Tests\\Http\\UriTest::testGetAuthority":0,"Slim\\Tests\\Http\\UriTest::testGetAuthorityWithNonStandardPort":0,"Slim\\Tests\\Http\\UriTest::testGetUserInfoWithUsernameAndPassword":0,"Slim\\Tests\\Http\\UriTest::testGetUserInfoWithUsername":0,"Slim\\Tests\\Http\\UriTest::testGetUserInfoNone":0,"Slim\\Tests\\Http\\UriTest::testGetUserInfoWithUsernameAndPasswordEncodesCorrectly":0,"Slim\\Tests\\Http\\UriTest::testWithUserInfo":0,"Slim\\Tests\\Http\\UriTest::testWithUserInfoEncodesCorrectly":0,"Slim\\Tests\\Http\\UriTest::testWithUserInfoRemovesPassword":0,"Slim\\Tests\\Http\\UriTest::testWithUserInfoRemovesInfo":0,"Slim\\Tests\\Http\\UriTest::testGetHost":0,"Slim\\Tests\\Http\\UriTest::testWithHost":0,"Slim\\Tests\\Http\\UriTest::testGetPortWithSchemeAndNonDefaultPort":0,"Slim\\Tests\\Http\\UriTest::testGetPortWithSchemeAndDefaultPort":0,"Slim\\Tests\\Http\\UriTest::testGetPortWithoutSchemeAndPort":0,"Slim\\Tests\\Http\\UriTest::testGetPortWithSchemeWithoutPort":0,"Slim\\Tests\\Http\\UriTest::testWithPort":0,"Slim\\Tests\\Http\\UriTest::testWithPortNull":0,"Slim\\Tests\\Http\\UriTest::testWithPortInvalidInt":0,"Slim\\Tests\\Http\\UriTest::testWithPortInvalidString":0,"Slim\\Tests\\Http\\UriTest::testGetBasePathNone":0,"Slim\\Tests\\Http\\UriTest::testWithBasePath":0,"Slim\\Tests\\Http\\UriTest::testWithBasePathInvalidType":0,"Slim\\Tests\\Http\\UriTest::testWithBasePathAddsPrefix":0,"Slim\\Tests\\Http\\UriTest::testWithBasePathIgnoresSlash":0,"Slim\\Tests\\Http\\UriTest::testGetPath":0,"Slim\\Tests\\Http\\UriTest::testWithPath":0,"Slim\\Tests\\Http\\UriTest::testWithPathWithoutPrefix":0,"Slim\\Tests\\Http\\UriTest::testWithPathEmptyValue":0,"Slim\\Tests\\Http\\UriTest::testWithPathUrlEncodesInput":0,"Slim\\Tests\\Http\\UriTest::testWithPathDoesNotDoubleEncodeInput":0,"Slim\\Tests\\Http\\UriTest::testWithPathInvalidType":0,"Slim\\Tests\\Http\\UriTest::testGetQuery":0,"Slim\\Tests\\Http\\UriTest::testWithQuery":0,"Slim\\Tests\\Http\\UriTest::testWithQueryRemovesPrefix":0,"Slim\\Tests\\Http\\UriTest::testWithQueryEmpty":0,"Slim\\Tests\\Http\\UriTest::testFilterQuery":0,"Slim\\Tests\\Http\\UriTest::testWithQueryInvalidType":0,"Slim\\Tests\\Http\\UriTest::testGetFragment":0,"Slim\\Tests\\Http\\UriTest::testWithFragment":0,"Slim\\Tests\\Http\\UriTest::testWithFragmentRemovesPrefix":0,"Slim\\Tests\\Http\\UriTest::testWithFragmentEmpty":0,"Slim\\Tests\\Http\\UriTest::testWithFragmentInvalidType":0,"Slim\\Tests\\Http\\UriTest::testToString":0,"Slim\\Tests\\Http\\UriTest::testCreateFromString":0,"Slim\\Tests\\Http\\UriTest::testCreateFromStringWithInvalidType":0,"Slim\\Tests\\Http\\UriTest::testCreateEnvironment":0,"Slim\\Tests\\Http\\UriTest::testCreateFromEnvironmentSetsDefaultPortWhenHostHeaderDoesntHaveAPort":0,"Slim\\Tests\\Http\\UriTest::testCreateEnvironmentWithIPv6HostNoPort":0,"Slim\\Tests\\Http\\UriTest::testCreateEnvironmentWithIPv6HostWithPort":0,"Slim\\Tests\\Http\\UriTest::testCreateEnvironmentWithNoHostHeader":0,"Slim\\Tests\\Http\\UriTest::testCreateEnvironmentWithBasePath":0,"Slim\\Tests\\Http\\UriTest::testGetBaseUrl":0,"Slim\\Tests\\Http\\UriTest::testGetBaseUrlWithNoBasePath":0,"Slim\\Tests\\Http\\UriTest::testGetBaseUrlWithAuthority":0,"Slim\\Tests\\Http\\UriTest::testWithPathWhenBaseRootIsEmpty":0,"Slim\\Tests\\Http\\UriTest::testRequestURIContainsIndexDotPhp":0,"Slim\\Tests\\Http\\UriTest::testRequestURICanContainParams":0,"Slim\\Tests\\Http\\UriTest::testUriDistinguishZeroFromEmptyString":0,"Slim\\Tests\\Http\\UriTest::testGetBaseUrlDistinguishZeroFromEmptyString":0,"Slim\\Tests\\Http\\UriTest::testConstructorWithEmptyPath":0,"Slim\\Tests\\Http\\UriTest::testConstructorWithZeroAsPath":0,"Slim\\Tests\\MiddlewareAwareTest::testSeedsMiddlewareStack":0,"Slim\\Tests\\MiddlewareAwareTest::testCallMiddlewareStack":0,"Slim\\Tests\\MiddlewareAwareTest::testMiddlewareStackWithAStatic":0,"Slim\\Tests\\MiddlewareAwareTest::testMiddlewareBadReturnValue":0,"Slim\\Tests\\MiddlewareAwareTest::testAlternativeSeedMiddlewareStack":0,"Slim\\Tests\\MiddlewareAwareTest::testAddMiddlewareWhileStackIsRunningThrowException":0,"Slim\\Tests\\MiddlewareAwareTest::testSeedTwiceThrowException":0,"Slim\\Tests\\RouteTest::testConstructor":0,"Slim\\Tests\\RouteTest::testGetMethodsReturnsArrayWhenContructedWithString":0,"Slim\\Tests\\RouteTest::testGetMethods":0,"Slim\\Tests\\RouteTest::testGetPattern":0,"Slim\\Tests\\RouteTest::testGetCallable":0,"Slim\\Tests\\RouteTest::testArgumentSetting":0,"Slim\\Tests\\RouteTest::testBottomMiddlewareIsRoute":0,"Slim\\Tests\\RouteTest::testAddMiddleware":0,"Slim\\Tests\\RouteTest::testRefinalizing":0,"Slim\\Tests\\RouteTest::testIdentifier":0,"Slim\\Tests\\RouteTest::testSetName":0,"Slim\\Tests\\RouteTest::testSetInvalidName":0,"Slim\\Tests\\RouteTest::testSetOutputBuffering":0,"Slim\\Tests\\RouteTest::testSetInvalidOutputBuffering":0,"Slim\\Tests\\RouteTest::testAddMiddlewareAsString":0,"Slim\\Tests\\RouteTest::testControllerInContainer":0,"Slim\\Tests\\RouteTest::testInvokeWhenReturningAResponse":0,"Slim\\Tests\\RouteTest::testInvokeWhenReturningAString":0,"Slim\\Tests\\RouteTest::testInvokeWithException":0,"Slim\\Tests\\RouteTest::testInvokeWhenDisablingOutputBuffer":0,"Slim\\Tests\\RouteTest::testInvokeDeferredCallable":0,"Slim\\Tests\\RouteTest::testPatternCanBeChanged":0,"Slim\\Tests\\RouteTest::testChangingCallable":0,"Slim\\Tests\\RouterTest::testMap":0,"Slim\\Tests\\RouterTest::testMapPrependsGroupPattern":0,"Slim\\Tests\\RouterTest::testMapWithInvalidPatternType":0,"Slim\\Tests\\RouterTest::testRelativePathFor":0,"Slim\\Tests\\RouterTest::testGetBasePath":0,"Slim\\Tests\\RouterTest::testPathForWithNoBasePath":0,"Slim\\Tests\\RouterTest::testPathForWithBasePath":0,"Slim\\Tests\\RouterTest::testPathForWithOptionalParameters":0,"Slim\\Tests\\RouterTest::testPathForWithQueryParameters":0,"Slim\\Tests\\RouterTest::testPathForWithNullQueryParameters":0,"Slim\\Tests\\RouterTest::testPathForWithMissingSegmentData":0,"Slim\\Tests\\RouterTest::testPathForRouteNotExists":0,"Slim\\Tests\\RouterTest::testSettingInvalidBasePath":0,"Slim\\Tests\\RouterTest::testCreateDispatcher":0,"Slim\\Tests\\RouterTest::testSetDispatcher":0,"Slim\\Tests\\RouterTest::testRemoveRoute":0,"Slim\\Tests\\RouterTest::testRouteRemovalNotExists":0,"Slim\\Tests\\RouterTest::testPathForWithModifiedRoutePattern":0,"Slim\\Tests\\RouterTest::testSettingCacheFileToFalse":0,"Slim\\Tests\\RouterTest::testSettingInvalidCacheFileValue":0,"Slim\\Tests\\RouterTest::testCacheFileExistsAndIsNotReadable":0,"Slim\\Tests\\RouterTest::testCacheFileDoesNotExistsAndDirectoryIsNotWritable":0,"Slim\\Tests\\RouterTest::testRouteCacheFileCanBeDispatched":0,"Slim\\Tests\\RouterTest::testCreateDispatcherReturnsSameDispatcherASecondTime":0,"Slim\\Tests\\RouterTest::testLookupRouteThrowsExceptionIfRouteNotFound":0,"Slim\\Tests\\RouterTest::testFullUrlFor":0}} \ No newline at end of file diff --git a/Slim/App.php b/Slim/App.php index 67a4d9ee..33ef14f3 100644 --- a/Slim/App.php +++ b/Slim/App.php @@ -661,9 +661,9 @@ protected function isEmptyResponse(ResponseInterface $response) * * @return bool */ - protected function isHeadRequest(RequestInterface $request) + protected function isHeadRequest(RequestInterface $request): bool { - return strtoupper($request->getMethod()) === 'HEAD'; + return strtoupper($request->getMethod() ?? '') === 'HEAD'; } /** diff --git a/Slim/Collection.php b/Slim/Collection.php index 2eaec44a..b16f8888 100644 --- a/Slim/Collection.php +++ b/Slim/Collection.php @@ -109,7 +109,7 @@ public function clear() * * @return bool */ - public function offsetExists($key) + public function offsetExists($key): bool { return $this->has($key); } @@ -121,7 +121,7 @@ public function offsetExists($key) * * @return mixed The key's value, or the default value */ - public function offsetGet($key) + public function offsetGet($key): mixed { return $this->get($key); } @@ -132,7 +132,7 @@ public function offsetGet($key) * @param string $key The data key * @param mixed $value The data value */ - public function offsetSet($key, $value) + public function offsetSet($key, $value): void { $this->set($key, $value); } @@ -142,7 +142,7 @@ public function offsetSet($key, $value) * * @param string $key The data key */ - public function offsetUnset($key) + public function offsetUnset($key): void { $this->remove($key); } @@ -152,7 +152,7 @@ public function offsetUnset($key) * * @return int */ - public function count() + public function count(): int { return count($this->data); } @@ -162,7 +162,7 @@ public function count() * * @return ArrayIterator */ - public function getIterator() + public function getIterator(): ArrayIterator { return new ArrayIterator($this->data); } diff --git a/Slim/Container.php b/Slim/Container.php index 4641f687..982c8f19 100644 --- a/Slim/Container.php +++ b/Slim/Container.php @@ -70,7 +70,7 @@ public function __construct(array $values = []) * * @return void */ - private function registerDefaultServices($userSettings) + private function registerDefaultServices($userSettings): void { $defaultSettings = $this->defaultSettings; @@ -100,7 +100,7 @@ private function registerDefaultServices($userSettings) * @throws ContainerValueNotFoundException No entry was found for this identifier. * @throws ContainerExceptionInterface Error while retrieving the entry. */ - public function get($id) + public function get($id): mixed { if (!$this->offsetExists($id)) { throw new ContainerValueNotFoundException(sprintf('Identifier "%s" is not defined.', $id)); @@ -111,7 +111,7 @@ public function get($id) if ($this->exceptionThrownByContainer($exception)) { throw new SlimContainerException( sprintf('Container error while retrieving "%s"', $id), - null, + 0, $exception ); } else { @@ -128,7 +128,7 @@ public function get($id) * * @return bool */ - private function exceptionThrownByContainer(InvalidArgumentException $exception) + private function exceptionThrownByContainer(InvalidArgumentException $exception): bool { $trace = $exception->getTrace()[0]; @@ -143,7 +143,7 @@ private function exceptionThrownByContainer(InvalidArgumentException $exception) * * @return boolean */ - public function has($id) + public function has($id): bool { return $this->offsetExists($id); } diff --git a/Slim/Handlers/AbstractError.php b/Slim/Handlers/AbstractError.php index 256062f7..39718816 100644 --- a/Slim/Handlers/AbstractError.php +++ b/Slim/Handlers/AbstractError.php @@ -32,7 +32,7 @@ public function __construct($displayErrorDetails = false) * * @return void */ - protected function writeToErrorLog($throwable) + protected function writeToErrorLog($throwable): void { if ($this->displayErrorDetails) { return; @@ -57,7 +57,7 @@ protected function writeToErrorLog($throwable) * * @return string */ - protected function renderThrowableAsText($throwable) + protected function renderThrowableAsText($throwable): string { $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable)); diff --git a/Slim/Http/Request.php b/Slim/Http/Request.php index 5df7405f..3f4e2e3a 100644 --- a/Slim/Http/Request.php +++ b/Slim/Http/Request.php @@ -475,7 +475,7 @@ public function isXhr() * * @return string */ - public function getRequestTarget() + public function getRequestTarget(): string { if ($this->requestTarget) { return $this->requestTarget; @@ -491,7 +491,7 @@ public function getRequestTarget() $basePath = ''; } $path = $this->uri->getPath(); - $path = $basePath . '/' . ltrim($path, '/'); + $path = $basePath . '/' . ltrim($path ?? '', '/'); $query = $this->uri->getQuery(); if ($query) { @@ -523,7 +523,7 @@ public function getRequestTarget() * * @throws InvalidArgumentException if the request target is invalid */ - public function withRequestTarget($requestTarget) + public function withRequestTarget($requestTarget): Request|static { if (preg_match('#\s#', $requestTarget)) { throw new InvalidArgumentException( @@ -545,7 +545,7 @@ public function withRequestTarget($requestTarget) * * @return UriInterface */ - public function getUri() + public function getUri(): UriInterface { return $this->uri; } @@ -582,7 +582,7 @@ public function getUri() * * @return static */ - public function withUri(UriInterface $uri, $preserveHost = false) + public function withUri(UriInterface $uri, $preserveHost = false): Request|static { $clone = clone $this; $clone->uri = $uri; @@ -607,7 +607,7 @@ public function withUri(UriInterface $uri, $preserveHost = false) * * @return string|null */ - public function getContentType() + public function getContentType(): ?string { $result = $this->getHeader('Content-Type'); @@ -621,7 +621,7 @@ public function getContentType() * * @return string|null */ - public function getMediaType() + public function getMediaType(): ?string { $contentType = $this->getContentType(); if ($contentType) { @@ -640,7 +640,7 @@ public function getMediaType() * * @return string[] */ - public function getMediaTypeParams() + public function getMediaTypeParams(): array { $contentType = $this->getContentType(); $contentTypeParams = []; @@ -663,7 +663,7 @@ public function getMediaTypeParams() * * @return string|null */ - public function getContentCharset() + public function getContentCharset(): ?string { $mediaTypeParams = $this->getMediaTypeParams(); if (isset($mediaTypeParams['charset'])) { @@ -680,7 +680,7 @@ public function getContentCharset() * * @return int|null */ - public function getContentLength() + public function getContentLength(): ?int { $result = $this->headers->get('Content-Length'); @@ -696,7 +696,7 @@ public function getContentLength() * * @return array */ - public function getCookieParams() + public function getCookieParams(): array { return $this->cookies; } @@ -711,7 +711,7 @@ public function getCookieParams() * * @return mixed */ - public function getCookieParam($key, $default = null) + public function getCookieParam($key, $default = null): mixed { $cookies = $this->getCookieParams(); $result = $default; @@ -740,7 +740,7 @@ public function getCookieParam($key, $default = null) * * @return static */ - public function withCookieParams(array $cookies) + public function withCookieParams(array $cookies): Request|static { $clone = clone $this; $clone->cookies = $cookies; @@ -760,7 +760,7 @@ public function withCookieParams(array $cookies) * * @return array */ - public function getQueryParams() + public function getQueryParams(): array { if (is_array($this->queryParams)) { return $this->queryParams; @@ -798,7 +798,7 @@ public function getQueryParams() * * @return static */ - public function withQueryParams(array $query) + public function withQueryParams(array $query): Request|static { $clone = clone $this; $clone->queryParams = $query; @@ -817,7 +817,7 @@ public function withQueryParams(array $query) * * @return array */ - public function getUploadedFiles() + public function getUploadedFiles(): array { return $this->uploadedFiles; } @@ -835,7 +835,7 @@ public function getUploadedFiles() * * @throws InvalidArgumentException if an invalid structure is provided. */ - public function withUploadedFiles(array $uploadedFiles) + public function withUploadedFiles(array $uploadedFiles): Request|static { $clone = clone $this; $clone->uploadedFiles = $uploadedFiles; @@ -852,7 +852,7 @@ public function withUploadedFiles(array $uploadedFiles) * * @return array */ - public function getServerParams() + public function getServerParams(): array { return $this->serverParams; } @@ -867,7 +867,7 @@ public function getServerParams() * * @return mixed */ - public function getServerParam($key, $default = null) + public function getServerParam($key, $default = null): mixed { $serverParams = $this->getServerParams(); @@ -885,7 +885,7 @@ public function getServerParam($key, $default = null) * * @return array */ - public function getAttributes() + public function getAttributes(): array { return $this->attributes->all(); } @@ -907,7 +907,7 @@ public function getAttributes() * * @return mixed */ - public function getAttribute($name, $default = null) + public function getAttribute($name, $default = null): mixed { return $this->attributes->get($name, $default); } @@ -929,7 +929,7 @@ public function getAttribute($name, $default = null) * * @return static */ - public function withAttribute($name, $value) + public function withAttribute($name, $value): Request|static { $clone = clone $this; $clone->attributes->set($name, $value); @@ -953,7 +953,7 @@ public function withAttribute($name, $value) * * @return static */ - public function withAttributes(array $attributes) + public function withAttributes(array $attributes): Request|static { $clone = clone $this; $clone->attributes = new Collection($attributes); @@ -977,7 +977,7 @@ public function withAttributes(array $attributes) * * @return static */ - public function withoutAttribute($name) + public function withoutAttribute($name): Request|static { $clone = clone $this; $clone->attributes->remove($name); @@ -1001,7 +1001,7 @@ public function withoutAttribute($name) * * @throws RuntimeException if the request body media type parser returns an invalid value */ - public function getParsedBody() + public function getParsedBody(): object|bool|array|null { if ($this->bodyParsed !== false) { return $this->bodyParsed; @@ -1016,7 +1016,7 @@ public function getParsedBody() // Check if this specific media type has a parser registered first if (!isset($this->bodyParsers[$mediaType])) { // If not, look for a media type with a structured syntax suffix (RFC 6839) - $parts = explode('+', $mediaType); + $parts = explode('+', $mediaType ?? ''); if (count($parts) >= 2) { $mediaType = 'application/' . $parts[count($parts)-1]; } @@ -1067,7 +1067,7 @@ public function getParsedBody() * @throws InvalidArgumentException if an unsupported argument type is * provided. */ - public function withParsedBody($data) + public function withParsedBody($data): Request|static { if (!is_null($data) && !is_object($data) && !is_array($data)) { throw new InvalidArgumentException('Parsed body value must be an array, an object, or null'); @@ -1086,7 +1086,7 @@ public function withParsedBody($data) * * @return $this */ - public function reparseBody() + public function reparseBody(): self { $this->bodyParsed = false; @@ -1101,7 +1101,7 @@ public function reparseBody() * @param string $mediaType A HTTP media type (excluding content-type params). * @param callable $callable A callable that returns parsed contents for media type. */ - public function registerMediaTypeParser($mediaType, callable $callable) + public function registerMediaTypeParser($mediaType, callable $callable): void { if ($callable instanceof Closure) { $callable = $callable->bindTo($this); @@ -1119,7 +1119,7 @@ public function registerMediaTypeParser($mediaType, callable $callable) * * @return mixed */ - public function getParam($key, $default = null) + public function getParam($key, $default = null): mixed { $postParams = $this->getParsedBody(); $getParams = $this->getQueryParams(); @@ -1145,7 +1145,7 @@ public function getParam($key, $default = null) * * @return mixed */ - public function getParsedBodyParam($key, $default = null) + public function getParsedBodyParam($key, $default = null): mixed { $postParams = $this->getParsedBody(); $result = $default; @@ -1168,7 +1168,7 @@ public function getParsedBodyParam($key, $default = null) * * @return mixed */ - public function getQueryParam($key, $default = null) + public function getQueryParam($key, $default = null): mixed { $getParams = $this->getQueryParams(); $result = $default; @@ -1188,7 +1188,7 @@ public function getQueryParam($key, $default = null) * * @return mixed[] */ - public function getParams(array $only = null) + public function getParams(array $only = null): array { $params = $this->getQueryParams(); $postParams = $this->getParsedBody(); @@ -1208,8 +1208,8 @@ public function getParams(array $only = null) return $params; } - - private static function disableXmlEntityLoader($disable) + + private static function disableXmlEntityLoader($disable): bool { if (\LIBXML_VERSION >= 20900) { // libxml >= 2.9.0 disables entity loading by default, so it is diff --git a/Slim/Http/Response.php b/Slim/Http/Response.php index 8ad475d4..7697d321 100644 --- a/Slim/Http/Response.php +++ b/Slim/Http/Response.php @@ -158,7 +158,7 @@ public function __clone() * * @return int */ - public function getStatusCode() + public function getStatusCode(): int { return $this->status; } @@ -186,11 +186,11 @@ public function getStatusCode() * * @throws InvalidArgumentException For invalid status code arguments. */ - public function withStatus($code, $reasonPhrase = '') + public function withStatus($code, $reasonPhrase = ''): Response|static { $code = $this->filterStatus($code); - if (!is_string($reasonPhrase) && !method_exists($reasonPhrase, '__toString')) { + if (!is_string($reasonPhrase) && !($reasonPhrase instanceof \Stringable)) { throw new InvalidArgumentException('ReasonPhrase must be a string'); } @@ -218,7 +218,7 @@ public function withStatus($code, $reasonPhrase = '') * * @throws InvalidArgumentException If an invalid HTTP status code is provided. */ - protected function filterStatus($status) + protected function filterStatus($status): int { if (!is_integer($status) || $statusreasonPhrase) { return $this->reasonPhrase; @@ -268,7 +268,7 @@ public function getReasonPhrase() * * @throws InvalidArgumentException For invalid header names or values. */ - public function withHeader($name, $value) + public function withHeader($name, $value): Response|static { $clone = clone $this; $clone->headers->set($name, $value); @@ -295,7 +295,7 @@ public function withHeader($name, $value) * * @return static */ - public function write($data) + public function write($data): static { $this->getBody()->write($data); @@ -315,7 +315,7 @@ public function write($data) * * @return static */ - public function withRedirect($url, $status = null) + public function withRedirect($url, $status = null): Response|static { $responseWithRedirect = $this->withHeader('Location', (string)$url); @@ -346,7 +346,7 @@ public function withRedirect($url, $status = null) * * @throws RuntimeException */ - public function withJson($data, $status = null, $encodingOptions = 0) + public function withJson($data, $status = null, $encodingOptions = 0): static { $response = $this->withBody(new Body(fopen('php://temp', 'r+'))); $response->body->write($json = json_encode($data, $encodingOptions)); @@ -370,7 +370,7 @@ public function withJson($data, $status = null, $encodingOptions = 0) * * @return bool */ - public function isEmpty() + public function isEmpty(): bool { return in_array( $this->getStatusCode(), @@ -385,7 +385,7 @@ public function isEmpty() * * @return bool */ - public function isInformational() + public function isInformational(): bool { return $this->getStatusCode() >= StatusCode::HTTP_CONTINUE && $this->getStatusCode() < StatusCode::HTTP_OK; } @@ -397,7 +397,7 @@ public function isInformational() * * @return bool */ - public function isOk() + public function isOk(): bool { return $this->getStatusCode() === StatusCode::HTTP_OK; } @@ -409,7 +409,7 @@ public function isOk() * * @return bool */ - public function isSuccessful() + public function isSuccessful(): bool { return $this->getStatusCode() >= StatusCode::HTTP_OK && $this->getStatusCode() < StatusCode::HTTP_MULTIPLE_CHOICES; @@ -422,7 +422,7 @@ public function isSuccessful() * * @return bool */ - public function isRedirect() + public function isRedirect(): bool { return in_array( $this->getStatusCode(), @@ -443,7 +443,7 @@ public function isRedirect() * * @return bool */ - public function isRedirection() + public function isRedirection(): bool { return $this->getStatusCode() >= StatusCode::HTTP_MULTIPLE_CHOICES && $this->getStatusCode() < StatusCode::HTTP_BAD_REQUEST; @@ -456,7 +456,7 @@ public function isRedirection() * * @return bool */ - public function isForbidden() + public function isForbidden(): bool { return $this->getStatusCode() === StatusCode::HTTP_FORBIDDEN; } @@ -468,7 +468,7 @@ public function isForbidden() * * @return bool */ - public function isNotFound() + public function isNotFound(): bool { return $this->getStatusCode() === StatusCode::HTTP_NOT_FOUND; } @@ -480,7 +480,7 @@ public function isNotFound() * * @return bool */ - public function isBadRequest() + public function isBadRequest(): bool { return $this->getStatusCode() === StatusCode::HTTP_BAD_REQUEST; } @@ -492,7 +492,7 @@ public function isBadRequest() * * @return bool */ - public function isClientError() + public function isClientError(): bool { return $this->getStatusCode() >= StatusCode::HTTP_BAD_REQUEST && $this->getStatusCode() < StatusCode::HTTP_INTERNAL_SERVER_ERROR; @@ -505,7 +505,7 @@ public function isClientError() * * @return bool */ - public function isServerError() + public function isServerError(): bool { return $this->getStatusCode() >= StatusCode::HTTP_INTERNAL_SERVER_ERROR && $this->getStatusCode() < 600; } diff --git a/Slim/Http/Uri.php b/Slim/Http/Uri.php index 5c67ec8c..9b9945b4 100644 --- a/Slim/Http/Uri.php +++ b/Slim/Http/Uri.php @@ -119,8 +119,8 @@ public function __construct( $this->host = $host; $this->port = $this->filterPort($port); $this->path = ($path === null || !strlen($path)) ? '/' : $this->filterPath($path); - $this->query = $this->filterQuery($query); - $this->fragment = $this->filterQuery($fragment); + $this->query = $this->filterQuery($query ?? ''); + $this->fragment = $this->filterQuery($fragment ?? ''); $this->user = $user; $this->password = $password; } @@ -132,9 +132,9 @@ public function __construct( * * @return self */ - public static function createFromString($uri) + public static function createFromString(mixed $uri): self { - if (!is_string($uri) && !method_exists($uri, '__toString')) { + if (!is_string($uri) && !($uri instanceof \Stringable)) { throw new InvalidArgumentException('Uri must be a string'); } @@ -158,7 +158,7 @@ public static function createFromString($uri) * * @return self */ - public static function createFromEnvironment(Environment $env) + public static function createFromEnvironment(Environment $env): self { // Scheme $isSecure = $env->get('HTTPS'); @@ -179,14 +179,14 @@ public static function createFromEnvironment(Environment $env) $port = (int)$env->get('SERVER_PORT', 80); } - if (preg_match('/^(\[[a-fA-F0-9:.]+\])(:\d+)?\z/', $host, $matches)) { + if (preg_match('/^(\[[a-fA-F0-9:.]+\])(:\d+)?\z/', $host ?? '', $matches)) { $host = $matches[1]; if (isset($matches[2])) { $port = (int) substr($matches[2], 1); } } else { - $pos = strpos($host, ':'); + $pos = strpos($host ?? '', ':'); if ($pos !== false) { $port = (int) substr($host, $pos + 1); $host = strstr($host, ':', true); @@ -246,7 +246,7 @@ public static function createFromEnvironment(Environment $env) * * @return string The URI scheme. */ - public function getScheme() + public function getScheme(): string { return $this->scheme; } @@ -268,7 +268,7 @@ public function getScheme() * * @throws InvalidArgumentException for invalid or unsupported schemes. */ - public function withScheme($scheme) + public function withScheme(mixed $scheme): self { $scheme = $this->filterScheme($scheme); $clone = clone $this; @@ -286,7 +286,7 @@ public function withScheme($scheme) * @throws InvalidArgumentException If the Uri scheme is not a string. * @throws InvalidArgumentException If Uri scheme is not "", "https", or "http". */ - protected function filterScheme($scheme) + protected function filterScheme(mixed $scheme): string { static $valid = [ '' => true, @@ -294,7 +294,7 @@ protected function filterScheme($scheme) 'http' => true, ]; - if (!is_string($scheme) && !method_exists($scheme, '__toString')) { + if (!is_string($scheme) && !($scheme instanceof \Stringable)) { throw new InvalidArgumentException('Uri scheme must be a string'); } @@ -325,7 +325,7 @@ protected function filterScheme($scheme) * * @return string The URI authority, in "[user-info@]host[:port]" format. */ - public function getAuthority() + public function getAuthority(): string { $userInfo = $this->getUserInfo(); $host = $this->getHost(); @@ -349,9 +349,9 @@ public function getAuthority() * * @return string The URI user information, in "username[:password]" format. */ - public function getUserInfo() + public function getUserInfo(): string { - return $this->user . ($this->password !== '' ? ':' . $this->password : ''); + return ($this->user ?? '') . ($this->password !== '' ? ':' . $this->password : ''); } /** @@ -365,11 +365,11 @@ public function getUserInfo() * information. * * @param string $user The user name to use for authority. - * @param null|string $password The password associated with $user. + * @param string|null $password The password associated with $user. * * @return self A new instance with the specified user information. */ - public function withUserInfo($user, $password = null) + public function withUserInfo(string $user, ?string $password = null): self { $clone = clone $this; $clone->user = $this->filterUserInfo($user); @@ -389,7 +389,7 @@ public function withUserInfo($user, $password = null) * * @return string The percent-encoded query string. */ - protected function filterUserInfo($query) + protected function filterUserInfo(string $query): string { return preg_replace_callback( '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=]+|%(?![A-Fa-f0-9]{2}))/u', @@ -412,9 +412,9 @@ function ($match) { * * @return string The URI host. */ - public function getHost() + public function getHost(): string { - return $this->host; + return $this->host ?? ''; } /** @@ -429,7 +429,7 @@ public function getHost() * * @return self A new instance with the specified host. */ - public function withHost($host) + public function withHost(string $host): self { $clone = clone $this; $clone->host = $host; @@ -452,7 +452,7 @@ public function withHost($host) * * @return null|int The URI port. */ - public function getPort() + public function getPort(): ?int { return $this->port && !$this->hasStandardPort() ? $this->port : null; } @@ -469,12 +469,12 @@ public function getPort() * A null value provided for the port is equivalent to removing the port * information. * - * @param null|int $port The port to use with the new instance; a null value + * @param int|null $port The port to use with the new instance; a null value * removes the port information. * * @return self A new instance with the specified port. */ - public function withPort($port) + public function withPort(mixed $port): self { $port = $this->filterPort($port); $clone = clone $this; @@ -488,7 +488,7 @@ public function withPort($port) * * @return bool */ - protected function hasStandardPort() + protected function hasStandardPort(): bool { return ($this->scheme === 'http' && $this->port === 80) || ($this->scheme === 'https' && $this->port === 443); } @@ -501,7 +501,7 @@ protected function hasStandardPort() * * @throws InvalidArgumentException If the port is invalid. */ - protected function filterPort($port) + protected function filterPort(mixed $port): ?int { if (is_null($port) || (is_integer($port) && ($port >= 1 && $port <= 65535))) { return $port; @@ -536,7 +536,7 @@ protected function filterPort($port) * * @return string The URI path. */ - public function getPath() + public function getPath(): string { return $this->path; } @@ -564,7 +564,7 @@ public function getPath() * * @throws InvalidArgumentException For invalid paths. */ - public function withPath($path) + public function withPath(mixed $path): self { if (!is_string($path)) { throw new InvalidArgumentException('Uri path must be a string'); @@ -591,7 +591,7 @@ public function withPath($path) * * @return string The base path segment of the URI. */ - public function getBasePath() + public function getBasePath(): string { return $this->basePath; } @@ -605,7 +605,7 @@ public function getBasePath() * * @return static */ - public function withBasePath($basePath) + public function withBasePath(mixed $basePath): self { if (!is_string($basePath)) { throw new InvalidArgumentException('Uri path must be a string'); @@ -638,7 +638,7 @@ public function withBasePath($basePath) * * @link http://www.faqs.org/rfcs/rfc3986.html */ - protected function filterPath($path) + protected function filterPath(string $path): string { return preg_replace_callback( '/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', @@ -670,7 +670,7 @@ function ($match) { * * @return string */ - public function getQuery() + public function getQuery(): string { return $this->query; } @@ -692,9 +692,9 @@ public function getQuery() * * @throws InvalidArgumentException For invalid query strings. */ - public function withQuery($query) + public function withQuery(mixed $query): self { - if (!is_string($query) && !method_exists($query, '__toString')) { + if (!is_string($query) && !($query instanceof \Stringable)) { throw new InvalidArgumentException('Uri query must be a string'); } $query = ltrim((string)$query, '?'); @@ -711,7 +711,7 @@ public function withQuery($query) * * @return string The percent-encoded query string. */ - protected function filterQuery($query) + protected function filterQuery(string $query): string { return preg_replace_callback( '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', @@ -739,7 +739,7 @@ function ($match) { * * @return string The URI fragment. */ - public function getFragment() + public function getFragment(): string { return $this->fragment; } @@ -759,9 +759,9 @@ public function getFragment() * * @return static A new instance with the specified fragment. */ - public function withFragment($fragment) + public function withFragment(mixed $fragment): self { - if (!is_string($fragment) && !method_exists($fragment, '__toString')) { + if (!is_string($fragment) && !($fragment instanceof \Stringable)) { throw new InvalidArgumentException('Uri fragment must be a string'); } $fragment = ltrim((string)$fragment, '#'); diff --git a/composer.json b/composer.json index 0fd93ded..e69b5a8a 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { - "name": "slim/slim", + "name": "coretech/slim-fork", "type": "library", - "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "description": "Fork of the Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs for php 8", "keywords": ["framework","micro","api","router"], "homepage": "https://slimframework.com", "license": "MIT", @@ -28,7 +28,7 @@ } ], "require": { - "php": ">=5.5.0", + "php": ">=7.4", "ext-json": "*", "ext-libxml": "*", "ext-simplexml": "*", @@ -39,7 +39,8 @@ }, "require-dev": { "squizlabs/php_codesniffer": "^3.6.0", - "phpunit/phpunit": "^4.0" + "phpunit/phpunit": "^9", + "phpspec/prophecy-phpunit": "^2.0" }, "provide": { "psr/http-message-implementation": "1.0" diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 00000000..5f95533e --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,13 @@ + + + + + ./Slim/ + + + + + ./tests/ + + + diff --git a/phpunit.xml.bak b/phpunit.xml.bak new file mode 100644 index 00000000..3fb4fd95 --- /dev/null +++ b/phpunit.xml.bak @@ -0,0 +1,29 @@ + + + + + + ./tests/ + + + + + + ./Slim/ + + + diff --git a/tests/AppTest.php b/tests/AppTest.php index 99ae8aff..5e99ed28 100644 --- a/tests/AppTest.php +++ b/tests/AppTest.php @@ -10,7 +10,6 @@ use BadMethodCallException; use Error; use Exception; -use PHPUnit_Framework_TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\UriInterface; @@ -44,32 +43,32 @@ function header($value, $replace = true) \Slim\header($value, $replace); } -class AppTest extends PHPUnit_Framework_TestCase +class AppTest extends MigratingTestCase { - public function setUp() + public function setUp(): void { HeaderStack::reset(); } - public function tearDown() + public function tearDown(): void { HeaderStack::reset(); } - public static function setupBeforeClass() + public static function setupBeforeClass(): void { // ini_set('log_errors', 0); ini_set('error_log', tempnam(sys_get_temp_dir(), 'slim')); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { // ini_set('log_errors', 1); } public function testContainerInterfaceException() { - $this->setExpectedException('InvalidArgumentException', 'Expected a ContainerInterface'); + $this->expectException('InvalidArgumentException', 'Expected a ContainerInterface'); $app = new App(''); } @@ -87,6 +86,7 @@ public function testGetRoute() // Do something }; $app = new App(); + /** @var \Slim\Route $route */ $route = $app->get($path, $callable); $this->assertInstanceOf('\Slim\Route', $route); @@ -1033,14 +1033,14 @@ public function testInvokeReturnMethodNotAllowed() $this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $resOut); $this->assertEquals(405, (string)$resOut->getStatusCode()); $this->assertEquals(['GET'], $resOut->getHeader('Allow')); - $this->assertContains( + $this->assertStringContainsString( '

Method not allowed. Must be one of: GET

', (string)$resOut->getBody() ); // now test that exception is raised if the handler isn't registered unset($app->getContainer()['notAllowedHandler']); - $this->setExpectedException('Slim\Exception\MethodNotAllowedException'); + $this->expectException('Slim\Exception\MethodNotAllowedException'); $app($req, $res); } @@ -1250,7 +1250,7 @@ public function testInvokeWithoutMatchingRoute() // now test that exception is raised if the handler isn't registered unset($app->getContainer()['notFoundHandler']); - $this->setExpectedException('Slim\Exception\NotFoundException'); + $this->expectException('Slim\Exception\NotFoundException'); $app($req, $res); } @@ -1317,7 +1317,7 @@ public function testInvokeWithPimpleUndefinedCallable() $app->get('/foo', 'foo:bar'); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); // Invoke app $app($req, $res); @@ -1891,7 +1891,7 @@ public function testExceptionErrorHandlerDoesNotDisplayErrorDetails() $resOut = $app->run(true); $this->assertEquals(500, $resOut->getStatusCode()); - $this->assertNotRegExp('/.*middleware exception.*/', (string)$resOut); + $this->assertDoesNotMatchRegularExpression('/.*middleware exception.*/', (string)$resOut); } /** @@ -1930,7 +1930,7 @@ public function testExceptionPhpErrorHandlerDoesNotDisplayErrorDetails() $resOut = $app->run(true); $this->assertEquals(500, $resOut->getStatusCode()); - $this->assertNotRegExp('/.*middleware exception.*/', (string)$resOut); + $this->assertDoesNotMatchRegularExpression('/.*middleware exception.*/', (string)$resOut); } /** @@ -1959,11 +1959,9 @@ public function appFactory() return $app; } - /** - * @expectedException Exception - */ public function testRunExceptionNoHandler() { + $this->expectException(Exception::class); $app = $this->appFactory(); $container = $app->getContainer(); @@ -1975,6 +1973,7 @@ public function testRunExceptionNoHandler() $app->add(function ($req, $res, $args) { throw new Exception(); }); + $this->expectException(Exception::class); $res = $app->run(true); } @@ -2031,11 +2030,9 @@ public function testRunNotFound() $this->assertEquals(404, $res->getStatusCode()); } - /** - * @expectedException \Slim\Exception\NotFoundException - */ public function testRunNotFoundWithoutHandler() { + $this->expectException(\Slim\Exception\NotFoundException::class); $app = $this->appFactory(); $container = $app->getContainer(); unset($container['notFoundHandler']); @@ -2046,6 +2043,7 @@ public function testRunNotFoundWithoutHandler() $app->add(function ($req, $res, $args) { throw new NotFoundException($req, $res); }); + $this->expectException(NotFoundException::class); $res = $app->run(true); } @@ -2064,11 +2062,9 @@ public function testRunNotAllowed() $this->assertEquals(405, $res->getStatusCode()); } - /** - * @expectedException \Slim\Exception\MethodNotAllowedException - */ public function testRunNotAllowedWithoutHandler() { + $this->expectException(\Slim\Exception\MethodNotAllowedException::class); $app = $this->appFactory(); $container = $app->getContainer(); unset($container['notAllowedHandler']); @@ -2079,6 +2075,7 @@ public function testRunNotAllowedWithoutHandler() $app->add(function ($req, $res, $args) { throw new MethodNotAllowedException($req, $res, ['POST']); }); + $this->expectException(MethodNotAllowedException::class); $res = $app->run(true); } @@ -2134,7 +2131,7 @@ public function testExceptionErrorHandlerDisplaysErrorDetails() $resOut = $app->run(true); $this->assertEquals(500, $resOut->getStatusCode()); - $this->assertRegExp('/.*middleware exception.*/', (string)$resOut); + $this->assertMatchesRegularExpression('/.*middleware exception.*/', (string)$resOut); } public function testFinalize() @@ -2186,34 +2183,29 @@ public function testCallingAContainerCallable() $this->assertSame(404, $response->getStatusCode()); } - /** - * @expectedException BadMethodCallException - */ public function testCallingFromContainerNotCallable() { + $this->expectException(BadMethodCallException::class); $settings = [ 'foo' => function ($c) { return null; } ]; $app = new App($settings); + $this->expectException(BadMethodCallException::class); $app->foo('bar'); } - /** - * @expectedException BadMethodCallException - */ public function testCallingAnUnknownContainerCallableThrows() { + $this->expectException(BadMethodCallException::class); $app = new App(); $app->foo('bar'); } - /** - * @expectedException BadMethodCallException - */ public function testCallingAnUncallableContainerKeyThrows() { + $this->expectException(BadMethodCallException::class); $app = new App(); $app->getContainer()['bar'] = 'foo'; $app->foo('bar'); @@ -2235,12 +2227,10 @@ public function testOmittingContentLength() $this->assertFalse($response->hasHeader('Content-Length')); } - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Unexpected data in output buffer - */ public function testForUnexpectedDataInOutputBuffer() { + $this->expectExceptionMessage("Unexpected data in output buffer"); + $this->expectException(RuntimeException::class); $this->expectOutputString('test'); // needed to avoid risky test warning echo "test"; $method = new ReflectionMethod('Slim\App', 'finalize'); diff --git a/tests/CallableResolverTest.php b/tests/CallableResolverTest.php index f3ac94d0..2ecbae91 100644 --- a/tests/CallableResolverTest.php +++ b/tests/CallableResolverTest.php @@ -7,20 +7,20 @@ namespace Slim\Tests; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Slim\CallableResolver; use Slim\Container; use Slim\Tests\Mocks\CallableTest; use Slim\Tests\Mocks\InvokableTest; -class CallableResolverTest extends PHPUnit_Framework_TestCase +class CallableResolverTest extends TestCase { /** * @var Container */ private $container; - public function setUp() + public function setUp(): void { CallableTest::$CalledCount = 0; InvokableTest::$CalledCount = 0; @@ -111,35 +111,35 @@ public function testMethodNotFoundThrowException() { $this->container['callable_service'] = new CallableTest(); $resolver = new CallableResolver($this->container); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $resolver->resolve('callable_service:noFound'); } public function testFunctionNotFoundThrowException() { $resolver = new CallableResolver($this->container); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $resolver->resolve('noFound'); } public function testClassNotFoundThrowException() { $resolver = new CallableResolver($this->container); - $this->setExpectedException('\RuntimeException', 'Callable Unknown does not exist'); + $this->expectException('\RuntimeException', 'Callable Unknown does not exist'); $resolver->resolve('Unknown:notFound'); } public function testCallableClassNotFoundThrowException() { $resolver = new CallableResolver($this->container); - $this->setExpectedException('\RuntimeException', 'is not resolvable'); + $this->expectException('\RuntimeException', 'is not resolvable'); $resolver->resolve(['Unknown', 'notFound']); } public function testCallableInvalidTypeThrowException() { $resolver = new CallableResolver($this->container); - $this->setExpectedException('\RuntimeException', 'is not resolvable'); + $this->expectException('\RuntimeException', 'is not resolvable'); $resolver->resolve(__LINE__); } } diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index 7c21c66a..e6a5fb4f 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -7,11 +7,12 @@ namespace Slim\Tests; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; use ReflectionProperty; use Slim\Collection; -class CollectionTest extends PHPUnit_Framework_TestCase +class CollectionTest extends TestCase { /** * @var Collection @@ -23,7 +24,7 @@ class CollectionTest extends PHPUnit_Framework_TestCase */ protected $property; - public function setUp() + public function setUp(): void { $this->bag = new Collection(); $this->property = new ReflectionProperty($this->bag, 'data'); diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php index b989bb2f..ee7000ca 100644 --- a/tests/ContainerTest.php +++ b/tests/ContainerTest.php @@ -8,18 +8,19 @@ namespace Slim\Tests; use InvalidArgumentException; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; use Psr\Container\ContainerInterface; use Slim\Container; -class ContainerTest extends PHPUnit_Framework_TestCase +class ContainerTest extends TestCase { /** * @var Container */ protected $container; - public function setUp() + public function setUp(): void { $this->container = new Container; } @@ -29,11 +30,9 @@ public function testGet() $this->assertInstanceOf('\Slim\Http\Environment', $this->container->get('environment')); } - /** - * @expectedException \Slim\Exception\ContainerValueNotFoundException - */ public function testGetWithValueNotFoundError() { + $this->expectException(\Slim\Exception\ContainerValueNotFoundException::class); $this->container->get('foo'); } @@ -41,10 +40,11 @@ public function testGetWithValueNotFoundError() * Test `get()` throws something that is a ContainerException - typically a NotFoundException, when there is a DI * config error * - * @expectedException \Slim\Exception\ContainerValueNotFoundException + * */ public function testGetWithDiConfigErrorThrownAsContainerValueNotFoundException() { + $this->expectException(\Slim\Exception\ContainerValueNotFoundException::class); $container = new Container; $container['foo'] = function (ContainerInterface $container) { @@ -58,10 +58,11 @@ function (ContainerInterface $container) { * Test `get()` recasts InvalidArgumentException as psr/container exceptions when an error is present * in the DI config * - * @expectedException \Slim\Exception\ContainerException + * */ public function testGetWithDiConfigErrorThrownAsInvalidArgumentException() { + $this->expectException(\Slim\Exception\ContainerException::class); $container = new Container; $container['foo'] = function (ContainerInterface $container) { @@ -74,10 +75,11 @@ function (ContainerInterface $container) { /** * Test `get()` does not recast exceptions which are thrown in a factory closure * - * @expectedException InvalidArgumentException + * */ public function testGetWithErrorThrownByFactoryClosure() { + $this->expectException(InvalidArgumentException::class); $invokable = $this->getMockBuilder('StdClass')->setMethods(['__invoke'])->getMock(); /** @var callable $invokable */ $invokable->expects($this->any()) diff --git a/tests/DeferredCallableTest.php b/tests/DeferredCallableTest.php index eb833830..6ab72d55 100644 --- a/tests/DeferredCallableTest.php +++ b/tests/DeferredCallableTest.php @@ -7,12 +7,13 @@ namespace Slim\Tests; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; use Slim\Container; use Slim\DeferredCallable; use Slim\Tests\Mocks\CallableTest; -class DeferredCallableTest extends PHPUnit_Framework_TestCase +class DeferredCallableTest extends TestCase { public function testItResolvesCallable() { diff --git a/tests/Handlers/AbstractHandlerTest.php b/tests/Handlers/AbstractHandlerTest.php index aa7d08ca..10dba4e9 100644 --- a/tests/Handlers/AbstractHandlerTest.php +++ b/tests/Handlers/AbstractHandlerTest.php @@ -7,11 +7,11 @@ namespace Slim\Tests\Handlers; -use PHPUnit_Framework_TestCase; use ReflectionClass; use Slim\Handlers\AbstractHandler; +use Slim\Tests\MigratingTestCase; -class AbstractHandlerTest extends PHPUnit_Framework_TestCase +class AbstractHandlerTest extends MigratingTestCase { public function testHalfValidContentType() { diff --git a/tests/Handlers/ErrorTest.php b/tests/Handlers/ErrorTest.php index d82c9a89..f5bc3cf5 100644 --- a/tests/Handlers/ErrorTest.php +++ b/tests/Handlers/ErrorTest.php @@ -8,16 +8,16 @@ namespace Slim\Tests\Handlers; use Exception; -use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; use ReflectionClass; use RuntimeException; use Slim\Handlers\Error; use Slim\Http\Request; use Slim\Http\Response; +use Slim\Tests\MigratingTestCase; use UnexpectedValueException; -class ErrorTest extends PHPUnit_Framework_TestCase +class ErrorTest extends MigratingTestCase { public function errorProvider() { @@ -67,11 +67,9 @@ public function testErrorDisplayDetails($acceptHeader, $contentType, $startOfBod $this->assertEquals(0, strpos((string)$res->getBody(), $startOfBody)); } - /** - * @expectedException UnexpectedValueException - */ public function testNotFoundContentType() { + $this->expectException(UnexpectedValueException::class); $errorMock = $this->getMockBuilder(Error::class)->setMethods(['determineContentType'])->getMock(); $errorMock->method('determineContentType') ->will($this->returnValue('unknown/type')); @@ -113,7 +111,7 @@ public function testRenderHtmlExceptionOrErrorTypeChecksParameter() $renderHtmlExceptionorError = $class->getMethod('renderHtmlExceptionOrError'); $renderHtmlExceptionorError->setAccessible(true); - $this->setExpectedException(RuntimeException::class); + $this->expectException(RuntimeException::class); $error = new Error(); $renderHtmlExceptionorError->invokeArgs($error, ['foo']); @@ -122,7 +120,7 @@ public function testRenderHtmlExceptionOrErrorTypeChecksParameter() /** * @param string $method * - * @return PHPUnit_Framework_MockObject_MockObject|Request + * @return MockObject|Request */ protected function getRequest($method, $acceptHeader) { diff --git a/tests/Handlers/NotAllowedTest.php b/tests/Handlers/NotAllowedTest.php index 49935b40..50d37ad3 100644 --- a/tests/Handlers/NotAllowedTest.php +++ b/tests/Handlers/NotAllowedTest.php @@ -7,13 +7,13 @@ namespace Slim\Tests\Handlers; -use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; use Slim\Handlers\NotAllowed; use Slim\Http\Request; use Slim\Http\Response; +use Slim\Tests\MigratingTestCase; -class NotAllowedTest extends PHPUnit_Framework_TestCase +class NotAllowedTest extends MigratingTestCase { public function invalidMethodProvider() { @@ -64,14 +64,14 @@ public function testNotFoundContentType() $errorMock->method('determineContentType') ->will($this->returnValue('unknown/type')); - $this->setExpectedException('\UnexpectedValueException'); + $this->expectException('\UnexpectedValueException'); $errorMock->__invoke($this->getRequest('GET', 'unknown/type'), new Response(), ['POST']); } /** * @param string $method * - * @return PHPUnit_Framework_MockObject_MockObject|Request + * @return MockObject|Request */ protected function getRequest($method, $contentType = 'text/html') { diff --git a/tests/Handlers/NotFoundTest.php b/tests/Handlers/NotFoundTest.php index 13351b2d..926db6d5 100644 --- a/tests/Handlers/NotFoundTest.php +++ b/tests/Handlers/NotFoundTest.php @@ -7,14 +7,14 @@ namespace Slim\Tests\Handlers; -use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; use Slim\Handlers\NotFound; use Slim\Http\Request; use Slim\Http\Response; use Slim\Http\Uri; +use Slim\Tests\MigratingTestCase; -class NotFoundTest extends PHPUnit_Framework_TestCase +class NotFoundTest extends MigratingTestCase { public function notFoundProvider() { @@ -53,14 +53,14 @@ public function testNotFoundContentType() $req = $this->getMockBuilder('Slim\Http\Request')->disableOriginalConstructor()->getMock(); - $this->setExpectedException('\UnexpectedValueException'); + $this->expectException('\UnexpectedValueException'); $errorMock->__invoke($req, new Response(), ['POST']); } /** * @param string $method * - * @return PHPUnit_Framework_MockObject_MockObject|Request + * @return MockObject|Request */ protected function getRequest($method, $contentType = 'text/html') { diff --git a/tests/Handlers/PhpErrorTest.php b/tests/Handlers/PhpErrorTest.php index 864495ef..90e8ddbd 100644 --- a/tests/Handlers/PhpErrorTest.php +++ b/tests/Handlers/PhpErrorTest.php @@ -8,15 +8,15 @@ namespace Slim\Tests\Handlers; use Exception; -use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; use Slim\Handlers\PhpError; use Slim\Http\Request; use Slim\Http\Response; +use Slim\Tests\MigratingTestCase; use Throwable; use UnexpectedValueException; -class PhpErrorTest extends PHPUnit_Framework_TestCase +class PhpErrorTest extends MigratingTestCase { public function phpErrorProvider() { @@ -79,7 +79,7 @@ public function testNotFoundContentType() $req = $this->getMockBuilder('Slim\Http\Request')->disableOriginalConstructor()->getMock(); - $this->setExpectedException('\UnexpectedValueException'); + $this->expectException('\UnexpectedValueException'); $errorMock->__invoke($req, new Response(), new Exception()); } @@ -142,10 +142,11 @@ public function testPhpErrorDisplayDetails5($acceptHeader, $contentType, $startO /** * @requires PHP 5.0 - * @expectedException UnexpectedValueException + * */ public function testNotFoundContentType5() { + $this->expectException(UnexpectedValueException::class); $this->skipIfPhp70(); $errorMock = $this->getMock(PhpError::class, ['determineContentType']); $errorMock->method('determineContentType') @@ -160,7 +161,7 @@ public function testNotFoundContentType5() /** * @param string $method * - * @return PHPUnit_Framework_MockObject_MockObject|Request + * @return MockObject|Request */ protected function getRequest($method, $acceptHeader) { diff --git a/tests/Http/BodyTest.php b/tests/Http/BodyTest.php index d14a6b80..77063b08 100644 --- a/tests/Http/BodyTest.php +++ b/tests/Http/BodyTest.php @@ -8,11 +8,11 @@ namespace Slim\Tests\Http; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; use ReflectionProperty; use Slim\Http\Body; +use Slim\Tests\MigratingTestCase; -class BodyTest extends PHPUnit_Framework_TestCase +class BodyTest extends MigratingTestCase { /** * @var string @@ -25,7 +25,7 @@ class BodyTest extends PHPUnit_Framework_TestCase */ protected $stream; - protected function tearDown() + protected function tearDown(): void { if (is_resource($this->stream) === true) { fclose($this->stream); @@ -60,11 +60,9 @@ public function testConstructorAttachesStream() $this->assertSame($this->stream, $bodyStream->getValue($body)); } - /** - * @expectedException InvalidArgumentException - */ public function testConstructorInvalidStream() { + $this->expectException(InvalidArgumentException::class); $this->stream = 'foo'; $body = new Body($this->stream); } @@ -198,7 +196,7 @@ public function testTellDetachedThrowsRuntimeException() $bodyStream->setAccessible(true); $bodyStream->setValue($body, null); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $body->tell(); } @@ -319,7 +317,7 @@ public function testSeekDetachedThrowsRuntimeException() $body = new Body($this->stream); $body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $body->seek(10); } @@ -339,7 +337,7 @@ public function testRewindDetachedThrowsRuntimeException() $body = new Body($this->stream); $body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $body->rewind(); } @@ -357,7 +355,7 @@ public function testReadDetachedThrowsRuntimeException() $body = new Body($this->stream); $body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $body->read(10); } @@ -379,7 +377,7 @@ public function testWriteDetachedThrowsRuntimeException() $body = new Body($this->stream); $body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $body->write('foo'); } @@ -398,7 +396,7 @@ public function testGetContentsDetachedThrowsRuntimeException() $body = new Body($this->stream); $body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $body->getContents(); } } diff --git a/tests/Http/CookiesTest.php b/tests/Http/CookiesTest.php index 9370b732..bf94031c 100644 --- a/tests/Http/CookiesTest.php +++ b/tests/Http/CookiesTest.php @@ -8,13 +8,13 @@ namespace Slim\Tests\Http; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; use ReflectionClass; use ReflectionProperty; use Slim\Http\Cookies; +use Slim\Tests\MigratingTestCase; use stdClass; -class CookiesTest extends PHPUnit_Framework_TestCase +class CookiesTest extends MigratingTestCase { public function testConstructor() { @@ -269,7 +269,7 @@ public function testToHeader() public function testParseHeaderException() { - $this->setExpectedException(InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); Cookies::parseHeader(new stdClass); } } diff --git a/tests/Http/EnvironmentTest.php b/tests/Http/EnvironmentTest.php index c0d8a54b..6f311dd0 100644 --- a/tests/Http/EnvironmentTest.php +++ b/tests/Http/EnvironmentTest.php @@ -7,16 +7,16 @@ namespace Slim\Tests\Http; -use PHPUnit_Framework_TestCase; use Slim\Http\Environment; +use Slim\Tests\MigratingTestCase; -class EnvironmentTest extends PHPUnit_Framework_TestCase +class EnvironmentTest extends MigratingTestCase { /** * Server settings for the default HTTP request * used by this script's tests. */ - public function setUp() + public function setUp(): void { $_SERVER['DOCUMENT_ROOT'] = '/var/www'; $_SERVER['SCRIPT_NAME'] = '/foo/index.php'; diff --git a/tests/Http/HeadersTest.php b/tests/Http/HeadersTest.php index c64de5b4..868db4eb 100644 --- a/tests/Http/HeadersTest.php +++ b/tests/Http/HeadersTest.php @@ -7,12 +7,12 @@ namespace Slim\Tests\Http; -use PHPUnit_Framework_TestCase; use ReflectionProperty; use Slim\Http\Environment; use Slim\Http\Headers; +use Slim\Tests\MigratingTestCase; -class HeadersTest extends PHPUnit_Framework_TestCase +class HeadersTest extends MigratingTestCase { public function testCreateFromEnvironment() { diff --git a/tests/Http/MessageTest.php b/tests/Http/MessageTest.php index 654fecd2..f19df420 100644 --- a/tests/Http/MessageTest.php +++ b/tests/Http/MessageTest.php @@ -8,13 +8,13 @@ namespace Slim\Tests\Http; use InvalidArgumentException; -use PHPUnit_Framework_MockObject_MockObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; use Slim\Http\Body; use Slim\Http\Headers; +use Slim\Tests\MigratingTestCase; use Slim\Tests\Mocks\MessageStub; -class MessageTest extends PHPUnit_Framework_TestCase +class MessageTest extends MigratingTestCase { public function testGetProtocolVersion() { @@ -32,11 +32,9 @@ public function testWithProtocolVersion() $this->assertEquals('1.0', $clone->protocolVersion); } - /** - * @expectedException InvalidArgumentException - */ public function testWithProtocolVersionInvalidThrowsException() { + $this->expectException(InvalidArgumentException::class); $message = new MessageStub(); $message->withProtocolVersion('3.0'); } @@ -169,7 +167,7 @@ public function testWithBody() } /** - * @return PHPUnit_Framework_MockObject_MockObject|Body + * @return MockObject|Body */ protected function getBody() { diff --git a/tests/Http/NonBufferedBodyTest.php b/tests/Http/NonBufferedBodyTest.php index 537612ac..2690f21e 100644 --- a/tests/Http/NonBufferedBodyTest.php +++ b/tests/Http/NonBufferedBodyTest.php @@ -7,19 +7,19 @@ namespace Slim\Tests\Http; -use PHPUnit_Framework_TestCase; use Slim\Http\NonBufferedBody; use Slim\Http\Response; use Slim\Tests\Assets\HeaderStack; +use Slim\Tests\MigratingTestCase; -class NonBufferedBodyTest extends PHPUnit_Framework_TestCase +class NonBufferedBodyTest extends MigratingTestCase { - protected function setUp() + protected function setUp(): void { HeaderStack::reset(); } - protected function tearDown() + protected function tearDown(): void { HeaderStack::reset(); } diff --git a/tests/Http/RequestBodyTest.php b/tests/Http/RequestBodyTest.php index 07f3b74e..6a222ee6 100644 --- a/tests/Http/RequestBodyTest.php +++ b/tests/Http/RequestBodyTest.php @@ -7,11 +7,11 @@ namespace Slim\Tests\Http; -use PHPUnit_Framework_TestCase; use ReflectionProperty; use Slim\Http\RequestBody; +use Slim\Tests\MigratingTestCase; -class RequestBodyTest extends PHPUnit_Framework_TestCase +class RequestBodyTest extends MigratingTestCase { /** @var string */ // @codingStandardsIgnoreStart @@ -26,14 +26,14 @@ class RequestBodyTest extends PHPUnit_Framework_TestCase * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - protected function setUp() + protected function setUp(): void { $this->body = new RequestBody(); $this->body->write($this->text); $this->body->rewind(); } - protected function tearDown() + protected function tearDown(): void { if (is_resource($this->stream) === true) { fclose($this->stream); @@ -147,7 +147,7 @@ public function testClose() $this->assertFalse($this->body->isWritable()); $this->assertEquals('', (string)$this->body); - $this->setExpectedException('RuntimeException'); + $this->expectException('RuntimeException'); $this->body->tell(); } @@ -178,7 +178,7 @@ public function testTellDetachedThrowsRuntimeException() $bodyStream->setAccessible(true); $bodyStream->setValue($this->body, null); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $this->body->tell(); } @@ -256,7 +256,7 @@ public function testSeekDetachedThrowsRuntimeException() { $this->body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $this->body->seek(10); } @@ -272,7 +272,7 @@ public function testRewindDetachedThrowsRuntimeException() { $this->body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $this->body->rewind(); } @@ -285,7 +285,7 @@ public function testReadDetachedThrowsRuntimeException() { $this->body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $this->body->read(10); } @@ -303,7 +303,7 @@ public function testWriteDetachedThrowsRuntimeException() { $this->body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $this->body->write('foo'); } @@ -318,7 +318,7 @@ public function testGetContentsDetachedThrowsRuntimeException() { $this->body->detach(); - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $this->body->getContents(); } } diff --git a/tests/Http/RequestTest.php b/tests/Http/RequestTest.php index 2ec74295..cb1bab2a 100644 --- a/tests/Http/RequestTest.php +++ b/tests/Http/RequestTest.php @@ -8,8 +8,8 @@ namespace Slim\Tests\Http; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\MethodProphecy; use Psr\Http\Message\UriInterface; use ReflectionProperty; @@ -21,9 +21,12 @@ use Slim\Http\RequestBody; use Slim\Http\UploadedFile; use Slim\Http\Uri; +use Slim\Tests\MigratingTestCase; -class RequestTest extends PHPUnit_Framework_TestCase +class RequestTest extends MigratingTestCase { + use ProphecyTrait; + public function requestFactory($envData = []) { $env = Environment::mock($envData); @@ -153,11 +156,9 @@ public function testWithAllAllowedCharactersMethod() $this->assertAttributeEquals("!#$%&'*+.^_`|~09AZ-", 'originalMethod', $request); } - /** - * @expectedException InvalidArgumentException - */ public function testWithMethodInvalid() { + $this->expectException(InvalidArgumentException::class); $this->requestFactory()->withMethod('B@R'); } @@ -288,11 +289,9 @@ public function testGetMethodOverrideParameterFromBodyArray() $this->assertEquals('PUT', $request->getMethod()); } - /** - * @expectedException InvalidArgumentException - */ public function testCreateRequestWithInvalidMethodString() { + $this->expectException(InvalidArgumentException::class); $uri = Uri::createFromString('https://example.com:443/foo/bar?abc=123'); $headers = new Headers(); $cookies = []; @@ -301,11 +300,9 @@ public function testCreateRequestWithInvalidMethodString() $request = new Request('B@R', $uri, $headers, $cookies, $serverParams, $body); } - /** - * @expectedException InvalidArgumentException - */ public function testCreateRequestWithInvalidMethodOther() { + $this->expectException(InvalidArgumentException::class); $uri = Uri::createFromString('https://example.com:443/foo/bar?abc=123'); $headers = new Headers(); $cookies = []; @@ -466,11 +463,9 @@ public function testWithRequestTarget() $this->assertAttributeEquals('/test?user=1', 'requestTarget', $clone); } - /** - * @expectedException InvalidArgumentException - */ public function testWithRequestTargetThatHasSpaces() { + $this->expectException(InvalidArgumentException::class); $this->requestFactory()->withRequestTarget('/test/m ore/stuff?user=1'); } @@ -1065,11 +1060,9 @@ public function testGetParsedBodyAfterCallReparseBody() $this->assertEquals(['abc' => '123'], $request->getParsedBody()); } - /** - * @expectedException RuntimeException - */ public function testGetParsedBodyAsArray() { + $this->expectException(RuntimeException::class); $uri = Uri::createFromString('https://example.com:443/foo/bar?abc=123'); $headers = new Headers([ 'Content-Type' => 'application/json;charset=utf8', @@ -1147,19 +1140,15 @@ public function testGetParsedBodyReturnsNullWhenThereIsNoMediaTypeParserRegister $this->assertNull($request->getParsedBody()); } - /** - * @expectedException InvalidArgumentException - */ public function testWithParsedBodyInvalid() { + $this->expectException(InvalidArgumentException::class); $this->requestFactory()->withParsedBody(2); } - /** - * @expectedException InvalidArgumentException - */ public function testWithParsedBodyInvalidFalseValue() { + $this->expectException(InvalidArgumentException::class); $this->requestFactory()->withParsedBody(false); } diff --git a/tests/Http/ResponseTest.php b/tests/Http/ResponseTest.php index faaaa3bf..cc1230a7 100755 --- a/tests/Http/ResponseTest.php +++ b/tests/Http/ResponseTest.php @@ -8,14 +8,14 @@ namespace Slim\Tests\Http; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; use ReflectionProperty; use RuntimeException; use Slim\Http\Body; use Slim\Http\Headers; use Slim\Http\Response; +use Slim\Tests\MigratingTestCase; -class ResponseTest extends PHPUnit_Framework_TestCase +class ResponseTest extends MigratingTestCase { public function testConstructorWithDefaultArgs() { @@ -76,21 +76,17 @@ public function testWithStatus() $this->assertAttributeEquals(302, 'status', $clone); } - /** - * @expectedException InvalidArgumentException - */ public function testWithStatusInvalidStatusCodeThrowsException() { + $this->expectException(InvalidArgumentException::class); $response = new Response(); $response->withStatus(800); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage ReasonPhrase must be a string - */ public function testWithStatusInvalidReasonPhraseThrowsException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("ReasonPhrase must be a string"); $response = new Response(); $response->withStatus(200, null); } @@ -109,12 +105,10 @@ public function testGetReasonPhrase() $this->assertEquals('Not Found', $response->getReasonPhrase()); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage ReasonPhrase must be supplied for this code - */ public function testMustSetReasonPhraseForUnrecognisedCode() { + $this->expectExceptionMessage("ReasonPhrase must be supplied for this code"); + $this->expectException(InvalidArgumentException::class); $response = new Response(); $response = $response->withStatus(199); } @@ -319,11 +313,9 @@ public function testWithJson() $this->assertEquals($response->getStatusCode(), 201); } - /** - * @expectedException RuntimeException - */ public function testWithInvalidJsonThrowsException() { + $this->expectException(RuntimeException::class); $data = ['foo' => 'bar'.chr(233)]; $this->assertEquals('bar'.chr(233), $data['foo']); diff --git a/tests/Http/StreamTest.php b/tests/Http/StreamTest.php index 1c5bbbe6..90a0f800 100644 --- a/tests/Http/StreamTest.php +++ b/tests/Http/StreamTest.php @@ -7,11 +7,11 @@ namespace Slim\Tests\Http; -use PHPUnit_Framework_TestCase; use RuntimeException; use Slim\Http\Stream; +use Slim\Tests\MigratingTestCase; -class StreamTest extends PHPUnit_Framework_TestCase +class StreamTest extends MigratingTestCase { /** * @var resource pipe stream file handle @@ -23,7 +23,7 @@ class StreamTest extends PHPUnit_Framework_TestCase */ private $pipeStream; - public function tearDown() + public function tearDown(): void { if ($this->pipeFh != null) { stream_get_contents($this->pipeFh); // prevent broken pipe error message @@ -58,31 +58,25 @@ public function testPipeIsNotSeekable() $this->assertFalse($this->pipeStream->isSeekable()); } - /** - * @expectedException RuntimeException - */ public function testCannotSeekPipe() { + $this->expectException(RuntimeException::class); $this->openPipeStream(); $this->pipeStream->seek(0); } - /** - * @expectedException RuntimeException - */ public function testCannotTellPipe() { + $this->expectException(RuntimeException::class); $this->openPipeStream(); $this->pipeStream->tell(); } - /** - * @expectedException RuntimeException - */ public function testCannotRewindPipe() { + $this->expectException(RuntimeException::class); $this->openPipeStream(); $this->pipeStream->rewind(); diff --git a/tests/Http/UploadedFilesTest.php b/tests/Http/UploadedFilesTest.php index 71246d1e..dd3c7d97 100644 --- a/tests/Http/UploadedFilesTest.php +++ b/tests/Http/UploadedFilesTest.php @@ -7,7 +7,6 @@ namespace Slim\Tests\Http; -use PHPUnit_Framework_TestCase; use RuntimeException; use Slim\Http\Environment; use Slim\Http\Headers; @@ -16,21 +15,22 @@ use Slim\Http\Stream; use Slim\Http\UploadedFile; use Slim\Http\Uri; +use Slim\Tests\MigratingTestCase; -class UploadedFilesTest extends PHPUnit_Framework_TestCase +class UploadedFilesTest extends MigratingTestCase { static private $filename = './phpUxcOty'; static private $tmpFiles = ['./phpUxcOty']; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { $fh = fopen(self::$filename, "w"); fwrite($fh, "12345678"); fclose($fh); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { foreach (self::$tmpFiles as $filename) { if (file_exists($filename)) { @@ -147,7 +147,7 @@ public function testMoveToNotWritable(UploadedFile $uploadedFile) { $tempName = uniqid('file-'); $path = 'some_random_dir' . DIRECTORY_SEPARATOR . $tempName; - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $uploadedFile->moveTo($path); } @@ -176,10 +176,11 @@ public function testMoveTo(UploadedFile $uploadedFile) * * @param UploadedFile $uploadedFile * - * @expectedException RuntimeException + * */ public function testMoveToCannotBeDoneTwice(UploadedFile $uploadedFile) { + $this->expectException(RuntimeException::class); $tempName = uniqid('file-'); $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $tempName; $uploadedFile->moveTo($path); @@ -198,7 +199,7 @@ public function testMoveToCannotBeDoneTwice(UploadedFile $uploadedFile) */ public function testMoveToAgain(UploadedFile $uploadedFile) { - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $tempName = uniqid('file-'); $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $tempName; @@ -214,7 +215,7 @@ public function testMoveToAgain(UploadedFile $uploadedFile) */ public function testMovedStream($uploadedFile) { - $this->setExpectedException('\RuntimeException'); + $this->expectException('\RuntimeException'); $uploadedFile->getStream(); } @@ -229,7 +230,7 @@ public function testMoveToStream() $movedFileContents = ob_get_clean(); $this->assertEquals($contents, $movedFileContents); - $this->assertFileNotExists($uploadedFile->file); + $this->assertFileDoesNotExist($uploadedFile->file); } public function providerCreateFromEnvironment() diff --git a/tests/Http/UriTest.php b/tests/Http/UriTest.php index c8dd0908..501ce717 100644 --- a/tests/Http/UriTest.php +++ b/tests/Http/UriTest.php @@ -8,11 +8,11 @@ namespace Slim\Tests\Http; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; use Slim\Http\Environment; use Slim\Http\Uri; +use Slim\Tests\MigratingTestCase; -class UriTest extends PHPUnit_Framework_TestCase +class UriTest extends MigratingTestCase { protected $uri; @@ -56,21 +56,17 @@ public function testWithSchemeEmpty() $this->assertAttributeEquals('', 'scheme', $uri); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri scheme must be one of: "", "https", "http" - */ public function testWithSchemeInvalid() { + $this->expectExceptionMessage("Uri scheme must be one of: \"\", \"https\", \"http\""); + $this->expectException(InvalidArgumentException::class); $this->uriFactory()->withScheme('ftp'); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri scheme must be a string - */ public function testWithSchemeInvalidType() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Uri scheme must be a string"); $this->uriFactory()->withScheme([]); } @@ -266,19 +262,15 @@ public function testWithPortNull() $this->assertAttributeEquals(null, 'port', $uri); } - /** - * @expectedException InvalidArgumentException - */ public function testWithPortInvalidInt() { + $this->expectException(InvalidArgumentException::class); $this->uriFactory()->withPort(70000); } - /** - * @expectedException InvalidArgumentException - */ public function testWithPortInvalidString() { + $this->expectException(InvalidArgumentException::class); $this->uriFactory()->withPort('Foo'); } @@ -294,12 +286,10 @@ public function testWithBasePath() $this->assertAttributeEquals('/base', 'basePath', $uri); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri path must be a string - */ public function testWithBasePathInvalidType() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Uri path must be a string"); $this->uriFactory()->withBasePath(['foo']); } @@ -357,12 +347,10 @@ public function testWithPathDoesNotDoubleEncodeInput() $this->assertAttributeEquals('/include%25s/new', 'path', $uri); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri path must be a string - */ public function testWithPathInvalidType() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Uri path must be a string"); $this->uriFactory()->withPath(['foo']); } @@ -399,12 +387,10 @@ public function testFilterQuery() $this->assertAttributeEquals('foobar=%25match', 'query', $uri); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri query must be a string - */ public function testWithQueryInvalidType() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Uri query must be a string"); $this->uriFactory()->withQuery(['foo']); } @@ -434,12 +420,10 @@ public function testWithFragmentEmpty() $this->assertAttributeEquals('', 'fragment', $uri); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri fragment must be a string - */ public function testWithFragmentInvalidType() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Uri fragment must be a string"); $this->uriFactory()->withFragment(['foo']); } @@ -480,12 +464,10 @@ public function testCreateFromString() $this->assertEquals('abc=123', $uri->getQuery()); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Uri must be a string - */ public function testCreateFromStringWithInvalidType() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Uri must be a string"); Uri::createFromString(['https://example.com:8080/foo/bar?abc=123']); } diff --git a/tests/MiddlewareAwareTest.php b/tests/MiddlewareAwareTest.php index b206f0fe..5ec50327 100644 --- a/tests/MiddlewareAwareTest.php +++ b/tests/MiddlewareAwareTest.php @@ -7,6 +7,7 @@ namespace Slim\Tests; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; use RuntimeException; use Slim\Http\Body; @@ -16,7 +17,7 @@ use Slim\Http\Uri; use Slim\Tests\Mocks\Stackable; -class MiddlewareAwareTest extends PHPUnit_Framework_TestCase +class MiddlewareAwareTest extends TestCase { public function testSeedsMiddlewareStack() { @@ -101,11 +102,9 @@ public function testMiddlewareStackWithAStatic() $this->assertEquals('In2In1CenterOut1Out2', (string)$res->getBody()); } - /** - * @expectedException RuntimeException - */ public function testMiddlewareBadReturnValue() { + $this->expectException(RuntimeException::class); // Build middleware stack $stack = new Stackable; $stack->add(function ($req, $res, $next) { @@ -160,7 +159,7 @@ public function testAddMiddlewareWhileStackIsRunningThrowException() }); return $resp; }); - $this->setExpectedException('RuntimeException'); + $this->expectException('RuntimeException'); $stack->callMiddlewareStack( $this->getMockBuilder('Psr\Http\Message\ServerRequestInterface')->disableOriginalConstructor()->getMock(), $this->getMockBuilder('Psr\Http\Message\ResponseInterface')->disableOriginalConstructor()->getMock() @@ -171,7 +170,7 @@ public function testSeedTwiceThrowException() { $stack = new Stackable; $stack->alternativeSeed(); - $this->setExpectedException('RuntimeException'); + $this->expectException('RuntimeException'); $stack->alternativeSeed(); } } diff --git a/tests/MigratingTestCase.php b/tests/MigratingTestCase.php new file mode 100644 index 00000000..cc543d1a --- /dev/null +++ b/tests/MigratingTestCase.php @@ -0,0 +1,91 @@ +getProperty($property); + $attributeValue = $reflection->getValue($object); + $this->assertEquals($value, $attributeValue); + } elseif (is_array($object)) { + $this->assertEquals($value, $object[$property]); + } else { + $this->fail(__METHOD__); + } + } + + public function assertAttributeSame(mixed $expected, string $property, mixed $object): void + { + if (is_object($object)) { + $reflectedClass = new ReflectionClass($object); + $reflection = $reflectedClass->getProperty($property); + $attributeValue = $reflection->getValue($object); + $this->assertSame($expected, $attributeValue); + } elseif (is_array($object)) { + $this->assertSame($expected, $object[$property]); + } else { + $this->fail(__METHOD__); + } + } + + public function assertAttributeNotSame(mixed $expected, string $property, mixed $object): void + { + if (is_object($object)) { + $reflectedClass = new ReflectionClass($object); + $reflection = $reflectedClass->getProperty($property); + $attributeValue = $reflection->getValue($object); + $this->assertNotSame($expected, $attributeValue); + } elseif (is_array($object)) { + $this->assertNotSame($expected, $object[$property]); + } else { + $this->fail(__METHOD__); + } + } + + public function assertAttributeContains(mixed $value, string $property, mixed $object): void + { + $reflectedClass = new ReflectionClass($object); + $reflection = $reflectedClass->getProperty($property); + $attributeValue = $reflection->getValue($object); + $this->assertIsArray($attributeValue); + $this->assertContains($value, $attributeValue); + } + + public function assertInternalType(string $type, mixed $object): void + { + switch ($type) { + case 'array': + $this->assertIsArray($object); + break; + case 'resource': + $this->assertIsResource($object); + break; + case 'boolean': + $this->assertIsBool($object); + break; + case 'callable': + $this->assertIsCallable($object); + break; + case 'int': + $this->assertIsInt($object); + break; + default: + $this->assertTrue(false, 'Unknown type to assert: ' . $type); + break; + } + } + + public function assertAttributeInstanceOf(string $expected, string $property, mixed $object): void + { + $reflectedClass = new ReflectionClass($object); + $reflection = $reflectedClass->getProperty($property); + $attributeValue = $reflection->getValue($object); + $this->assertInstanceOf($expected, $attributeValue); + } +} diff --git a/tests/RouteTest.php b/tests/RouteTest.php index 5e2527df..25f098de 100644 --- a/tests/RouteTest.php +++ b/tests/RouteTest.php @@ -8,7 +8,6 @@ namespace Slim\Tests; use Exception; -use PHPUnit_Framework_TestCase; use Slim\Container; use Slim\DeferredCallable; use Slim\Http\Body; @@ -22,7 +21,7 @@ use Slim\Tests\Mocks\InvocationStrategyTest; use Slim\Tests\Mocks\MiddlewareStub; -class RouteTest extends PHPUnit_Framework_TestCase +class RouteTest extends MigratingTestCase { public function routeFactory() { @@ -176,7 +175,7 @@ public function testSetInvalidName() { $route = $this->routeFactory(); - $this->setExpectedException('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $route->setName(false); } @@ -201,7 +200,7 @@ public function testSetInvalidOutputBuffering() { $route = $this->routeFactory(); - $this->setExpectedException('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $route->setOutputBuffering('invalid'); } @@ -298,11 +297,9 @@ public function testInvokeWhenReturningAString() $this->assertEquals('foo', (string)$response->getBody()); } - /** - * @expectedException Exception - */ public function testInvokeWithException() { + $this->expectException(Exception::class); $callable = function ($req, $res, $args) { throw new Exception(); }; diff --git a/tests/RouterTest.php b/tests/RouterTest.php index d825d5cc..0cb0a31d 100644 --- a/tests/RouterTest.php +++ b/tests/RouterTest.php @@ -14,7 +14,7 @@ use Slim\Http\Uri; use Slim\Router; -class RouterTest extends PHPUnit_Framework_TestCase +class RouterTest extends \Slim\Tests\MigratingTestCase { /** * @var Router @@ -26,14 +26,14 @@ class RouterTest extends PHPUnit_Framework_TestCase */ protected $cacheFile; - public function setUp() + public function setUp(): void { $this->router = new Router; } - public function tearDown() + public function tearDown(): void { - if (file_exists($this->cacheFile)) { + if (file_exists($this->cacheFile ?? '')) { unlink($this->cacheFile); } } @@ -67,12 +67,10 @@ public function testMapPrependsGroupPattern() $this->assertAttributeEquals('/prefix/hello/{first}/{last}', 'pattern', $route); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Route pattern must be a string - */ public function testMapWithInvalidPatternType() { + $this->expectExceptionMessage("Route pattern must be a string"); + $this->expectException(InvalidArgumentException::class); $methods = ['GET']; $pattern = ['foo']; $callable = function ($request, $response, $args) { @@ -196,11 +194,9 @@ public function testPathForWithNullQueryParameters() ); } - /** - * @expectedException InvalidArgumentException - */ public function testPathForWithMissingSegmentData() { + $this->expectException(InvalidArgumentException::class); $methods = ['GET']; $pattern = '/hello/{first}/{last}'; $callable = function ($request, $response, $args) { @@ -212,11 +208,9 @@ public function testPathForWithMissingSegmentData() $this->router->pathFor('foo', ['last' => 'lockhart']); } - /** - * @expectedException RuntimeException - */ public function testPathForRouteNotExists() { + $this->expectException(RuntimeException::class); $methods = ['GET']; $pattern = '/hello/{first}/{last}'; $callable = function ($request, $response, $args) { @@ -228,11 +222,9 @@ public function testPathForRouteNotExists() $this->router->pathFor('bar', ['first' => 'josh', 'last' => 'lockhart']); } - /** - * @expectedException InvalidArgumentException - */ public function testSettingInvalidBasePath() { + $this->expectException(InvalidArgumentException::class); $this->router->setBasePath(['invalid']); } @@ -256,11 +248,9 @@ public function testSetDispatcher() $this->assertInstanceOf('\FastRoute\Dispatcher', $prop->getValue($this->router)); } - /** - * @expectedException RuntimeException - */ public function testRemoveRoute() { + $this->expectException(RuntimeException::class); $methods = ['GET']; $callable = function ($request, $response, $args) { echo sprintf('Hello ignore me'); @@ -312,11 +302,9 @@ public function testRemoveRoute() $this->router->getNamedRoute($routeToRemove->getName()); } - /** - * @expectedException RuntimeException - */ public function testRouteRemovalNotExists() { + $this->expectException(RuntimeException::class); $this->router->setBasePath('/base/path'); $this->router->removeNamedRoute('non-existing-route-name'); } @@ -354,7 +342,7 @@ public function testSettingCacheFileToFalse() public function testSettingInvalidCacheFileValue() { - $this->setExpectedException( + $this->expectException( '\InvalidArgumentException', 'Router cache file must be a string' ); @@ -366,7 +354,7 @@ public function testCacheFileExistsAndIsNotReadable() $this->cacheFile = __DIR__ . '/non-readable.cache'; file_put_contents($this->cacheFile, ''); - $this->setExpectedException( + $this->expectException( '\RuntimeException', sprintf('Router cache file `%s` is not readable', $this->cacheFile) ); @@ -378,7 +366,7 @@ public function testCacheFileDoesNotExistsAndDirectoryIsNotWritable() { $cacheFile = __DIR__ . '/non-writable-directory/router.cache'; - $this->setExpectedException( + $this->expectException( '\RuntimeException', sprintf('Router cache file directory `%s` is not writable', dirname($cacheFile)) ); @@ -436,11 +424,9 @@ public function testCreateDispatcherReturnsSameDispatcherASecondTime() $this->assertSame($dispatcher2, $dispatcher); } - /** - * @expectedException RuntimeException - */ public function testLookupRouteThrowsExceptionIfRouteNotFound() { + $this->expectException(RuntimeException::class); $this->router->lookupRoute("thisIsMissing"); }