Skip to content

Conversation

alexander-schranz
Copy link
Contributor

@alexander-schranz alexander-schranz commented Oct 18, 2019

Fix compatibility to symfony 5.0.

Needs:

TODO:

  • Use symfony/phpunit-bridge to use correct PhpUnit version for PHP version to run not into prefer lowest errors caused by phpunit
  • 1x: The default value of the "$secure" and "$samesite" arguments of "Symfony\Component\HttpFoundation\Cookie::__construct"'s constructor will respectively change from "false" to "null" and from "null" to "lax" in Symfony 5.0, you should define their values explicitly or use "Cookie::create()" instead. 1x in Psr6StoreTest::testLookupWithVaryOnCookies from Toflar\Psr6HttpCacheStore
  • Element 'phpunit', attribute 'syntaxCheck': The attribute 'syntaxCheck' is not allowed

@alexander-schranz alexander-schranz changed the title WIP: Test agains symfony 5.0 Test agains symfony 5.0 Oct 18, 2019
@alexander-schranz
Copy link
Contributor Author

alexander-schranz commented Oct 18, 2019

@Toflar do you want to keep support the old symfony versions? Or do you want to set min requirement to 4.4?

@alexander-schranz alexander-schranz changed the title Test agains symfony 5.0 Add symfony 5.0 compatibility Oct 18, 2019
@alexander-schranz alexander-schranz force-pushed the enhancement/test-agains-dev-symfony branch 5 times, most recently from 7b9dfca to 7606188 Compare October 18, 2019 20:45
@alexander-schranz alexander-schranz force-pushed the enhancement/test-agains-dev-symfony branch from 7606188 to 41fd7d9 Compare October 18, 2019 20:56
Copy link
Owner

@Toflar Toflar left a comment

Choose a reason for hiding this comment

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

@Toflar do you want to keep support the old symfony versions? Or do you want to set min requirement to 4.4?

I would like to keep them because 3.4 is LTS for another two years and I'm not sure for Sulu and for eZ Publish (cc @andrerom) but for Contao we have LTS for another 2 years as well :)
We may raise them to 3.4 conistently though.

composer.json Outdated
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.12",
"phpunit/phpunit": "^5.7.27",
"symfony/phpunit-bridge": "dev-master",
Copy link
Owner

Choose a reason for hiding this comment

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

Is there no stable release yet that works for us?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The SetUpTearDownTrait is needed to support this wide range on php versions with phpunit. This was added symfony/symfony#32922 which is only available in 4.4.

I can also workaround this problem by refractoring the tests that no tearDown and setUp is needed.

Copy link
Contributor Author

@alexander-schranz alexander-schranz Oct 21, 2019

Choose a reason for hiding this comment

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

$entries = $cacheItem->get();

$this->assertInternalType('array', $entries, 'Entries are stored in cache.');
$this->assertTrue(is_array($entries), 'Entries are stored in cache.');
Copy link
Owner

Choose a reason for hiding this comment

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

This should be \is_array(). Normally, I have my CS fixer set up so that it automatically fixes those. Did I miss that here maybe or did you just not run the CS fixer? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No the ci didn't tell me todo this 😄 maybe you want to activate https://prettyci.com/ for this project.

Copy link
Owner

Choose a reason for hiding this comment

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

We may also just add the cs fixer to the travis job, but don't worry, I'll do that :)

@Toflar Toflar self-assigned this Oct 21, 2019
@andrerom
Copy link

I would like to keep them because 3.4 is LTS for another two years and I'm not sure for Sulu and for eZ Publish

In eZ Platform we don't yet use this in stable version, we use this in 3.x which will be on Symfony 4.4. So should rather check with FosHttpCache 2.x users if they need this on Symfony 3.4LTS or not, there probably are some.

@Toflar
Copy link
Owner

Toflar commented Oct 21, 2019

I see. Well, as we're using it in Contao it's out of scope anyway :) So this will remain PHP 5.6 and Symfony 3.4 compatible for another 2 years. Also, it's just one class so it's rather easy for us to remain compatible with all the different combinations.

@alexander-schranz so I'm waiting with this for symfony/symfony#34036, right?

@alexander-schranz alexander-schranz force-pushed the enhancement/test-agains-dev-symfony branch 2 times, most recently from 5eef667 to 74de0cd Compare October 21, 2019 17:56
@alexander-schranz
Copy link
Contributor Author

@Toflar yes would wait for symfony/symfony#34036 getting merged. Sadly with phpunit bridge its currently not possible to test agains PHP 8 (would need: symfony/symfony#33642).
And not using the PHPUnit bridge will end in reflection errors on prefer lowest on 7.4 and 8.0.

@alexander-schranz alexander-schranz force-pushed the enhancement/test-agains-dev-symfony branch 2 times, most recently from c4c2856 to 58c6d94 Compare October 22, 2019 11:05
@alexander-schranz alexander-schranz force-pushed the enhancement/test-agains-dev-symfony branch from 58c6d94 to a3a7c22 Compare October 22, 2019 16:01
@Toflar
Copy link
Owner

Toflar commented Oct 23, 2019

I'm totally fine using the phpunit bridge :) I would just like to use stable versions if possible but we could've used dev-master until 4.4 was released. But I see you've already revertet it 🙈

@alexander-schranz
Copy link
Contributor Author

@Toflar yes stable version is used now by set phpunit version to 7 for newer php version in the newly created bin/phpunit script. Is something missing? The coverage I can sadly not fix because of class_exist check that part is never reached when the coverage is generated.

@Toflar
Copy link
Owner

Toflar commented Oct 23, 2019

Squashed, merged and released as 2.1.1. Thank you so much @alexander-schranz!

@Toflar Toflar closed this Oct 23, 2019
@alexander-schranz
Copy link
Contributor Author

@Toflar Thank you!

@alexander-schranz alexander-schranz deleted the enhancement/test-agains-dev-symfony branch October 23, 2019 12:34
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.

3 participants