Skip to content

Ignore E2E test data for Git export #622

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

Open
wants to merge 1 commit into
base: 5.11.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

/tools export-ignore
/tests/benchmarks export-ignore
/tests/data export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
Expand Down
5 changes: 5 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use PhpMyAdmin\SqlParser\Translator;
use PHPUnit\Framework\TestCase as BaseTestCase;

use function file_exists;
use function file_get_contents;
use function str_contains;
use function strpos;
Expand Down Expand Up @@ -93,6 +94,10 @@ public function getErrorsAsArray($obj): array
*/
public function getData(string $name): array
{
if (! file_exists('tests/data/' . $name . '.out')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be too risky for new tests to have missing data
can you check in setUp() if the folder exists?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There some test classes that have more than e2e tests, so skipping in setUp() will also skip valid tests that do not depend on that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best option is to refactor the tests, but I don't know how much refactoring is needed. I already attempted changing those tests (#598), but I'm yet to find a good solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, can you turn the phpunit to error when there is skipped tests on the CI?
I think that will be a good safety measure
Or use incomplete instead of skipped

self::markTestSkipped('Test data not available.');
}

$serializedData = file_get_contents('tests/data/' . $name . '.out');
$this->assertIsString($serializedData);

Expand Down
Loading