-
Notifications
You must be signed in to change notification settings - Fork 0
cleans up flash message keys. #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <?php | ||
|
|
||
| namespace Tests\Unit\Cms\Enums; | ||
|
|
||
| use Neuron\Cms\Enums\FlashMessageType; | ||
| use PHPUnit\Framework\TestCase; | ||
|
|
||
| /** | ||
| * Tests for FlashMessageType enum | ||
| * | ||
| * @package Tests\Unit\Cms\Enums | ||
| */ | ||
| class FlashMessageTypeTest extends TestCase | ||
| { | ||
| /** | ||
| * Test that viewKey() returns capitalized version of the enum value | ||
| * | ||
| * The viewKey() method provides consistent view variable names | ||
| * (e.g., $Success, $Error) for use in templates. | ||
| */ | ||
| public function testViewKeyReturnsCapitalizedValue(): void | ||
| { | ||
| $this->assertEquals( 'Success', FlashMessageType::SUCCESS->viewKey() ); | ||
| $this->assertEquals( 'Error', FlashMessageType::ERROR->viewKey() ); | ||
| $this->assertEquals( 'Warning', FlashMessageType::WARNING->viewKey() ); | ||
| $this->assertEquals( 'Info', FlashMessageType::INFO->viewKey() ); | ||
| } | ||
|
|
||
| /** | ||
| * Test that enum values remain lowercase for session storage | ||
| * | ||
| * The value property should remain lowercase for consistency | ||
| * with session flash key storage. | ||
| */ | ||
| public function testEnumValuesAreLowercase(): void | ||
| { | ||
| $this->assertEquals( 'success', FlashMessageType::SUCCESS->value ); | ||
| $this->assertEquals( 'error', FlashMessageType::ERROR->value ); | ||
| $this->assertEquals( 'warning', FlashMessageType::WARNING->value ); | ||
| $this->assertEquals( 'info', FlashMessageType::INFO->value ); | ||
| } | ||
|
|
||
| /** | ||
| * Test that all enum cases exist | ||
| * | ||
| * Ensures all expected flash message types are defined. | ||
| */ | ||
| public function testAllCasesExist(): void | ||
| { | ||
| $cases = FlashMessageType::cases(); | ||
| $this->assertCount( 4, $cases ); | ||
|
|
||
| $values = array_map( fn( $case ) => $case->value, $cases ); | ||
| $this->assertContains( 'success', $values ); | ||
| $this->assertContains( 'error', $values ); | ||
| $this->assertContains( 'warning', $values ); | ||
| $this->assertContains( 'info', $values ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing view updates break flash messages on multiple pages
High Severity
The controllers now pass flash message data using
viewKey()which returns capitalized keys ('Success','Error'), but several view templates still expect lowercase variables ($success,$error). Onlyresources/views/admin/events/index.phpwas updated. The views for Event Categories, Media, Pages, and Profile still use lowercase variables and will silently fail to display any flash messages to users.Additional Locations (2)
src/Cms/Controllers/Admin/Pages.php#L90-L92src/Cms/Controllers/Admin/Profile.php#L84-L86