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, ); } }