-
-
Notifications
You must be signed in to change notification settings - Fork 3
fix: add ArrayAccess to Session class #7
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
Conversation
I looked into the tests but I have no experience with behat. I'm unsure if I could write tests for this without spending a lot of time learning it. |
@yani please rebase off the latest master branch and resolve conflicts. You'll see I've added features/access.feature and tests/behavior/AccessContext.php. You'll want to modify each test case and add a corresponding method as follows:
Simply add /**
* @Then array check returns false
*/
public function arrayCheckReturnsFalse(): void
{
Assert::assertFalse(isset($this->session['foo']));
} |
Will do. Thanks |
Updated:
|
Resolves #4 Co-authored-by: Yani <[email protected]>
This PR implements \ArrayAccess (#4)
The class now also triggers an error on retrieval of non-existing properties and array keys. This is consistent with original PHP behaviour. Retrieval still returns null when the error is triggered as this is also original behaviour. I had to use
E_USER_WARNING
instead ofE_WARNING
though. Would it be wise to change them to Exceptions?I'm unsure where to add decent testing. I didn't find any tests for testing properties themselves. Should it go into
PersistenceContext
or a new test file?