Move all files to tome/

This commit is contained in:
Oliver Davies 2025-10-01 00:05:52 +01:00
parent 5675bcfc36
commit 674daab35b
2874 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace Drupal\Tests\opd_presentations\Action;
use Drupal\Tests\opd_presentations\Traits\PresentationCreationTrait;
use Drupal\opd_presentations\Action\CountGivenPresentations;
use Drupal\opd_presentations\Events;
use weitzman\DrupalTestTraits\ExistingSiteBase;
final class CountGivenPresentationsTest extends ExistingSiteBase {
use PresentationCreationTrait;
public function test_it_counts_events(): void {
$action = $this->container->get(CountGivenPresentations::class);
assert($action instanceof CountGivenPresentations);
$this->createPresentation(
Events::fromDateStrings('yesterday'),
);
$this->assertGreaterThanOrEqual(
actual: $action(),
expected: 1,
);
}
public function test_it_only_counts_published_events(): void {
$action = $this->container->get(CountGivenPresentations::class);
assert($action instanceof CountGivenPresentations);
// Get the existing presentation count (including existing nodes).
$originalCount = $action();
$this->createPresentation(
events: Events::fromDateStrings('yesterday'),
isPublished: FALSE,
);
// Ensure the count has only increased by one, even though an unpublished
// presentation was created.
$this->assertSame(
actual: $action(),
expected: $originalCount,
);
}
public function test_it_only_counts_past_events(): void {
$action = $this->container->get(CountGivenPresentations::class);
assert($action instanceof CountGivenPresentations);
// Get the existing presentation count (including existing nodes).
$originalCount = $action();
$this->assertGreaterThanOrEqual(
actual: $originalCount,
expected: 0,
);
$this->createPresentation(
Events::fromDateStrings('tomorrow', 'yesterday'),
);
// Ensure the count has only increased by one, even though a future and past event were created.
$this->assertSame(
actual: $action(),
expected: $originalCount + 1,
);
}
}