Skip to content

Fix CI Build and update PHPUnit #545

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
merged 9 commits into from
Aug 19, 2020

Conversation

alexander-schranz
Copy link
Contributor

@alexander-schranz alexander-schranz commented Aug 4, 2020

Locally I run into the following problem:

PHP Fatal error: Declaration of FOS\HttpCacheBundle\Tests\Unit\CacheManagerTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in ~/Sulu/sulu-develop.localhost/vendor/friendsofsymfony/http-cache-bundle/tests/Unit/CacheManagerTest.php on line 28

Fatal error: Declaration of FOS\HttpCacheBundle\Tests\Unit\CacheManagerTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in ~/Sulu/sulu-develop.localhost/vendor/friendsofsymfony/http-cache-bundle/tests/Unit/CacheManagerTest.php on line 28

This seems to be fixed by using:

<server name="SYMFONY_PHPUNIT_VERSION" value="6.5" />

Which seems to be set in the .travis.yml also. I think I would remove it there so it works locally also.

But then I run into the following error:

PHP Fatal error: Declaration of Mockery\Adapter\Phpunit\TestListener::endTest(PHPUnit\Framework\Test $test, float $time): void must be compatible with PHPUnit\Framework\TestListener::endTest(PHPUnit\Framework\Test $test, $time) in /Users/alexanderschranz/Documents/Sulu/sulu20-develop.localhost/vendor/friendsofsymfony/http-cache-bundle/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php on line 39

So I decided to update to PHPUnit 8. Which seems to fix this error.

@alexander-schranz alexander-schranz changed the title Fix styleci and set correct version of mockery Fix CI Build and update PHPUnit Aug 4, 2020
@alexander-schranz
Copy link
Contributor Author

@dbu any idea about the failing test?

@alexander-schranz
Copy link
Contributor Author

Seems like a regression in: https://github.com/symfony/symfony/pull/36243/files#r465083756


class ContextInvalidationLogoutHandlerTest extends WebTestCase
{
use MockeryPHPUnitIntegration;

public function testLogout()
{
if (class_exists(LogoutEvent::class)) {
// @see https://github.com/symfony/symfony/pull/36243/files#r465083756
$this->markTestSkipped('This test does not work with Symfony 5.1.');
Copy link
Contributor

Choose a reason for hiding this comment

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

lets wait until tomorrow if we get a reaction on for https://github.com/symfony/symfony/pull/36243/files#r465083756 and then either remove this again, or also add a check to the actual implementation to make people realize the handler does not work with symfony 5.1

Copy link
Contributor Author

@alexander-schranz alexander-schranz Aug 19, 2020

Choose a reason for hiding this comment

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

Are you sure you want to throw an exception when the ContextInvalidationLogoutHandler class is used in Symfony 5.1? I'm little bit afraid doing that 🙈

Copy link
Contributor

Choose a reason for hiding this comment

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

i think its the correct thing to do. its not something we can silently work around, it simply does not work at all so devs need to be made aware if they did not check the changelog. better a clear error than a security issue that is silently sitting there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 853eaa0

@alexander-schranz alexander-schranz marked this pull request as ready for review August 19, 2020 14:37
Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

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

some wording changes for the exception, otherwise i am happy with it

@dbu dbu merged commit 74cb0e5 into FriendsOfSymfony:master Aug 19, 2020
@dbu
Copy link
Contributor

dbu commented Aug 19, 2020

thanks a lot!

@alexander-schranz alexander-schranz deleted the bugfix/fix-build branch August 19, 2020 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants