Add build test on PHP 8.0 & 8.1

Add `isTransactional` to `WallabagMigration` because PHP 8 behave differently with PDO transaction.
This is a workaround because we can't upgrade Doctrine Migration for now (upper versions have the fix).

- Build is now using Composer v2 (instead of v1)
- All actions have been updated to latest version
- Fix bug in PHP 8 were `$entry->getTags()` can't be properly used as a _traversable_ by `assertContains` during tests. Added a custom method `Entry::getTagsLabel()` which return a flatted tag array with only label
- Replace `assertNotRegExp` by `assertDoesNotMatchRegularExpression` because it was deprecated
This commit is contained in:
Jeremy Benoist
2022-01-31 09:27:20 +01:00
parent 6aeaaaabdd
commit 3c507d676f
15 changed files with 48 additions and 23 deletions

View File

@ -342,7 +342,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$entry = $em
->getRepository('WallabagCoreBundle:Entry')
->findOneByUrl($url);
$tags = $entry->getTags();
$tags = $entry->getTagsLabel();
$this->assertCount(2, $tags);
$this->assertContains('wallabag', $tags);
@ -372,7 +372,7 @@ class EntryControllerTest extends WallabagCoreTestCase
->getRepository('WallabagCoreBundle:Entry')
->findOneByUrl($url);
$tags = $entry->getTags();
$tags = $entry->getTagsLabel();
$this->assertCount(2, $tags);
$this->assertContains('wallabag', $tags);

View File

@ -46,7 +46,7 @@ class TagControllerTest extends WallabagCoreTestCase
// be sure to reload the entry
$entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
$this->assertCount(1, $entry->getTags());
$this->assertContains($this->tagName, $entry->getTags());
$this->assertContains($this->tagName, $entry->getTagsLabel());
// tag already exists and already assigned
$client->submit($form, $data);
@ -127,7 +127,7 @@ class TagControllerTest extends WallabagCoreTestCase
// re-retrieve the entry to be sure to get fresh data from database (mostly for tags)
$entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
$this->assertNotContains($this->tagName, $entry->getTags());
$this->assertNotContains($this->tagName, $entry->getTagsLabel());
$client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId());