website icon indicating copy to clipboard operation
website copied to clipboard

tests aren't working

Open tacman opened this issue 7 months ago • 0 comments

For example:

6) App\Tests\Crawling\BatSignalCrawlerTest::testSignalExists
TypeError: App\Crawling\BatSignalCrawler::__construct(): Argument #2 ($notificationPublisher) must be of type App\Crawling\NotificationPublisher, Mock_BatSignalRepository_86f1ae6a given, called in /home/tac/g/tacman/no-agenda/tests/Crawling/BatSignalCrawlerTest.php on line 28

/home/tac/g/tacman/no-agenda/src/Crawling/BatSignalCrawler.php:19
/home/tac/g/tacman/no-agenda/tests/Crawling/BatSignalCrawlerTest.php:28

The issue is

    $this->crawler = new BatSignalCrawler($this->entityManager, $this->repository, $this->httpClient, 'foo', 1);

But the signature for BatSignalCrawler is

    public function __construct(
        private readonly EntityManagerInterface $entityManager,
        private readonly NotificationPublisher $notificationPublisher,
        private readonly BatSignalRepository $batSignalRepository,
        private readonly HttpClientInterface $mastodonClient,
        private readonly NotifierInterface $notifier,
        private readonly ?string $mastodonAccessToken,
        private readonly int $mastodonAccountId,
    ) {
        $this->logger = new NullLogger();
    }

There are a few ways to solve this, but tests aren't passing in CI either, so perhaps I just caught this mid-development.

https://github.com/NoAgenda/website/actions/runs/14533600321

tacman avatar May 07 '25 10:05 tacman