Skip to content

Commit

Permalink
test(phpstan): Fix node publish/unpublish calls in tests (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
klausi authored Aug 31, 2023
1 parent bf9dea3 commit db158cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
webonyx/graphql-php:^14.8 \
drupal/typed_data:^1.0 \
drupal/redirect:^1.0 \
phpstan/phpstan:^1.7.14 \
phpstan/phpstan:^1.10.32 \
mglaman/phpstan-drupal:^1.1.2 \
phpstan/phpstan-deprecation-rules:^1.0.0 \
jangregor/phpstan-prophecy:^1.0.0 \
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ parameters:
# Not sure we can specify generic types properly with Drupal coding standards
# yet, disable for now.
checkGenericClassInNonGenericObjectType: false
# Sometimes we have a mismatch between local execution and CI, we don't care
# about ignored errors that are not triggered.
reportUnmatchedIgnoredErrors: false
excludePaths:
# Exclude the RouteLoad producer because the redirect module is not D10
# compatible so we are not downloading it.
Expand Down
12 changes: 6 additions & 6 deletions tests/src/Kernel/DataProducer/Routing/RouteEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public function setUp(): void {
$this->unpublished_node->save();

$this->translation_fr_unpublished = $this->unpublished_node->addTranslation('fr', ['title' => 'Test Unpublished Event FR']);
$this->translation_fr_unpublished->status = NodeInterface::NOT_PUBLISHED;
$this->translation_fr_unpublished->setUnpublished();
$this->translation_fr_unpublished->save();

$this->translation_de_unpublished = $this->unpublished_node->addTranslation('de', ['title' => 'Test Unpublished Event DE']);
$this->translation_de_unpublished->status = NodeInterface::NOT_PUBLISHED;
$this->translation_de_unpublished->setUnpublished();
$this->translation_de_unpublished->save();

// Unpublished node to published translations.
Expand All @@ -68,11 +68,11 @@ public function setUp(): void {
$this->unpublished_to_published_node->save();

$this->translation_fr_unpublished_to_published = $this->unpublished_to_published_node->addTranslation('fr', ['title' => 'Test Unpublished to Published Event FR']);
$this->translation_fr_unpublished_to_published->status = NodeInterface::PUBLISHED;
$this->translation_fr_unpublished_to_published->setPublished();
$this->translation_fr_unpublished_to_published->save();

$this->translation_de_unpublished_to_published = $this->unpublished_to_published_node->addTranslation('de', ['title' => 'Test Unpublished to Published Event DE']);
$this->translation_de_unpublished_to_published->status = NodeInterface::PUBLISHED;
$this->translation_de_unpublished_to_published->setPublished();
$this->translation_de_unpublished_to_published->save();

// Published node to unpublished translations.
Expand All @@ -84,11 +84,11 @@ public function setUp(): void {
$this->published_to_unpublished_node->save();

$this->translation_fr_published_to_unpublished = $this->published_to_unpublished_node->addTranslation('fr', ['title' => 'Test Published to Unpublished Event FR']);
$this->translation_fr_published_to_unpublished->status = NodeInterface::NOT_PUBLISHED;
$this->translation_fr_published_to_unpublished->setUnpublished();
$this->translation_fr_published_to_unpublished->save();

$this->translation_de_published_to_unpublished = $this->published_to_unpublished_node->addTranslation('de', ['title' => 'Test Published to Unpublished Event DE']);
$this->translation_de_published_to_unpublished->status = NodeInterface::NOT_PUBLISHED;
$this->translation_de_published_to_unpublished->setUnpublished();
$this->translation_de_published_to_unpublished->save();

\Drupal::service('content_translation.manager')->setEnabled('node', 'event', TRUE);
Expand Down

0 comments on commit db158cc

Please sign in to comment.