Skip to content

test: ensure no .env when EncryptionTest is run #8392

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

Merged

Conversation

paulbalandan
Copy link
Member

Description
For contributors, when running EncryptionTest and there is a .env file in the root, tests will fail because of a set encryption key.

There were 2 failures:

1) CodeIgniter\Encryption\EncryptionTest::testConstructor
Failed asserting that a string is empty.

/Users/paul/Workspace/CodeIgniter4/tests/system/Encryption/EncryptionTest.php:61

2) CodeIgniter\Encryption\EncryptionTest::testServiceWithoutKey
Failed asserting that exception of type "CodeIgniter\Encryption\Exceptions\EncryptionException" is thrown.

This PR will backup the .env and unset any environment variables already set by the file.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan added the testing Pull requests that changes tests only label Dec 30, 2023
@paulbalandan paulbalandan merged commit 5f655f1 into codeigniter4:develop Jan 2, 2024
@paulbalandan paulbalandan deleted the encryption-test-with-env branch January 2, 2024 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Pull requests that changes tests only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants