Add framework basics #24
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Research
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No project
No assignees
1 participant
Notifications
Total time spent: 1 hour 27 minutes
Due date
c.fahner
1 hour 27 minutes
No due date set.
Dependencies
No dependencies set.
Reference
slendium/framework!24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issues/1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #1.
Adds the main framework entry point: the
ApplicationclassAdds many Application-related classes:
Action,Configs,Module,ActionRewriter,RequestRouter, et al.Refactors the last parts of
Resource\HandlerintoApplication\RequestHandlerAdds a clearer separation in the tests namespace:
Common,UnitandIntegrationHandling of
IllegalActionExceptioninApplication\RequestHandlerstill needs to be implemented.An issue should be opened to trigger an "abuse report" in this situation.
@ -0,0 +6,4 @@* A configured alias of an application module.** Aliases can be any non-empty string, but keep in mind that they are used in URL's and database* table names.Add that they should be kept simple: alphanumeric and underscores.
@ -0,0 +43,4 @@: new DateTimeImmutable;return $dateValue > $futureLimit? throw new Exception('Auto expiring modes may not be configured beyond one day into the future')Should be
ApplicationException, which also means it can be tested more accurately.@ -0,0 +32,4 @@$uniqueModules = [ ];foreach ($source as $alias => $module) {if (isset($aliasMap[$alias])) {throw new LogicException("Unexpected duplicate module alias `$alias`");Should beApplicationExceptionEdit: the exception for duplicate aliases is unreachable from the public API and will therefore be left as a generic exception
@ -0,0 +35,4 @@throw new LogicException("Unexpected duplicate module alias `$alias`");}if (isset($uniqueModules[$module::class])) {throw new LogicException('Unexpected duplicate module type `'.$module::class.'`');Should be
ApplicationException@ -0,0 +14,4 @@* @author C. Fahner* @copyright Slendium 2026*/final class ApplicationException extends Exception {Should extend
LogicException@ -0,0 +117,4 @@return false;}private function createErrorResponse(string $errorMessage): Response {Rename to indicate this method is for "sensitive" errors,
createSensitiveErrorResponse()?@ -0,0 +8,4 @@* A module that provides a default resource.** @since 1.0* @authorAdd author/copyright
@ -0,0 +14,4 @@*/class BaseArgumentTest extends ResponseTestCase {public function test_application_handleRequest_shouldRespondWithSuccess_whenRequiredQueryArgumentGiven(): void {_shouldRespond2xx@ -0,0 +27,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWith400_whenRequiredQueryArgumentOmitted(): void {_shouldRespond400@ -0,0 +38,4 @@$this->assertResponseStatus(400, $result);}public function test_application_handleRequest_shouldRespondWithSucces_whenOptionalQueryArgumentOmitted(): void {_shouldRespond2xx@ -0,0 +51,4 @@$this->assertBody($expectedBody, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenOptionalQueryArgumentGiven(): void {_shouldRespond2xx@ -0,0 +98,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenRequiredBodyArgumentGiven(): void {_shouldRespond2xx@ -0,0 +112,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWith400_whenRequiredBodyArgumentOmitted(): void {_shouldRespond400@ -0,0 +123,4 @@$this->assertResponseStatus(400, $result);}public function test_application_handleRequest_shouldRespondWithSucces_whenOptionalBodyArgumentMissing(): void {_shouldRespond2xx@ -0,0 +136,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenOptionalBodyArgumentGiven(): void {_shouldRespond2xx@ -0,0 +150,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenRequiredCookieArgumentGiven(): void {_shouldRespond2xx@ -0,0 +164,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWith400_whenRequiredCookieArgumentOmitted(): void {_shouldRespond400@ -0,0 +175,4 @@$this->assertResponseStatus(400, $result);}public function test_application_handleRequest_shouldRespondWithSucces_whenOptionalCookieArgumentMissing(): void {_shouldRespond2xx@ -0,0 +188,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenOptionalCookieArgumentGiven(): void {_shouldRespond2xx@ -0,0 +202,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenRequiredHeaderArgumentGiven(): void {_shouldRespond2xx@ -0,0 +216,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWith400_whenRequiredHeaderArgumentOmitted(): void {_shouldRespond400@ -0,0 +227,4 @@$this->assertResponseStatus(400, $result);}public function test_application_handleRequest_shouldRespondWithSucces_whenOptionalHeaderArgumentMissing(): void {_shouldRespond2xx@ -0,0 +240,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenOptionalHeaderArgumentGiven(): void {_shouldRespond2xx@ -0,0 +254,4 @@$this->assertBody($expectedResult, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenEitherAltOrMainArgumentNameGiven(): void {_shouldRespond2xx@ -0,0 +330,4 @@$this->assertResponseStatusRange(400, 499, $result);}public function test_application_handleRequest_shouldRespondWith400_whenArgumentDoesNotValidate(): void {_shouldRespond400@ -0,0 +339,4 @@$this->assertResponseStatus(400, $result);}public function test_application_handleRequest_shouldRespondWithSuccess_whenArgumentDoesValidate(): void {_shouldRespond2xx@ -0,0 +8,4 @@/*** @internal* @author C. Fahner* @copyrightAdd copyright
@ -0,0 +62,4 @@$debugUntil = (new DateTime)->modify('+2 days')->format('Y-m-d');// Assert$this->expectException(Exception::class);Should become
ApplicationException@ -0,0 +73,4 @@$debugUntil = \date('Y-m-d\TH:i:s');// Assert$this->expectException(Exception::class);Should become
ApplicationException@ -0,0 +105,4 @@$this->assertFalse($resultFalse);}public function test_modules_offsetExists_shouldReturnExpectedResult_whenGivenAliasObject(): void {_whenAliasObjectGiven@ -0,0 +178,4 @@public function test___construct_shouldThrow_whenPassingSameModuleTypeTwice(): void {// Assert$this->expectException(Exception::class);Should become
ApplicationException@ -0,0 +15,4 @@* @author C. Fahner* @copyright Slendium 2026*/final class IllegalActionExceptionTest extends TestCase {Should use
ExceptionTestCaseinstead@ -0,0 +15,4 @@*/final class AliasTest extends TestCase {public function test___construct_shouldNotCrash(): void {_shouldNotThrow