Skip to content

Commit 50d73d7

Browse files
committed
Undo the changes to the test setup
Because these changes are causing the build to fail, I will put them in another PR to track it
1 parent f1449c5 commit 50d73d7

7 files changed

Lines changed: 17 additions & 25 deletions

File tree

.github/workflows/action.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ jobs:
6161
key: ${{ runner.os }}-composer-no-dev-${{ hashFiles('**/composer.lock') }}
6262

6363
- run: cp .env.example .env
64-
65-
- run: composer install --no-scripts --no-dev --no-progress
66-
name: Composer install without scripts
67-
68-
- run: composer dump-env prod
69-
7064
- name: Composer install
7165
run: composer install --no-dev --no-progress
7266

config/services.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,6 @@ services:
239239
event: kernel.controller_arguments,
240240
}
241241

242-
# Testing
243-
App\Tests\Service\:
244-
resource: '../tests/Service/'
245-
246242
# Feeds
247243
debril.rss_atom.provider:
248244
class: App\Feed\Provider

src/Service/ActivityPub/ApHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Psr\Cache\InvalidArgumentException;
2020
use Psr\Log\LoggerInterface;
2121
use Symfony\Component\Cache\CacheItem;
22-
use Symfony\Component\DependencyInjection\Attribute\WhenNot;
2322
use Symfony\Component\HttpClient\CurlHttpClient;
2423
use Symfony\Contracts\Cache\CacheInterface;
2524
use Symfony\Contracts\Cache\ItemInterface;
@@ -42,7 +41,6 @@ enum ApRequestType
4241
case NodeInfo;
4342
}
4443

45-
#[WhenNot(env: 'test')]
4644
class ApHttpClient implements ApHttpClientInterface
4745
{
4846
public const TIMEOUT = 8;

src/Service/ImageManager.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
use App\Exception\ImageDownloadTooLargeException;
99
use League\Flysystem\FilesystemOperator;
1010
use Psr\Log\LoggerInterface;
11-
use Symfony\Component\DependencyInjection\Attribute\WhenNot;
1211
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
1312
use Symfony\Component\Mime\MimeTypesInterface;
1413
use Symfony\Component\Validator\Constraints\Image;
1514
use Symfony\Component\Validator\Validator\ValidatorInterface;
1615
use Symfony\Contracts\HttpClient\HttpClientInterface;
1716

18-
#[WhenNot(env: 'test')]
1917
class ImageManager implements ImageManagerInterface
2018
{
2119
public const IMAGE_MIMETYPES = [

tests/Service/TestingApHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
use App\Entity\Magazine;
88
use App\Entity\User;
99
use App\Service\ActivityPub\ApHttpClientInterface;
10-
use Symfony\Component\DependencyInjection\Attribute\When;
1110

12-
#[When(env: 'test')]
1311
class TestingApHttpClient implements ApHttpClientInterface
1412
{
1513
/**

tests/Service/TestingImageManager.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
use App\Service\SettingsManager;
1111
use League\Flysystem\FilesystemOperator;
1212
use Psr\Log\LoggerInterface;
13-
use Symfony\Component\DependencyInjection\Attribute\When;
1413
use Symfony\Component\Mime\MimeTypesInterface;
1514
use Symfony\Component\Validator\Validator\ValidatorInterface;
1615
use Symfony\Contracts\HttpClient\HttpClientInterface;
1716

18-
#[When(env: 'test')]
1917
class TestingImageManager implements ImageManagerInterface
2018
{
2119
private ImageManager $innerImageManager;

tests/WebTestCase.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
use App\Tests\Service\TestingImageManager;
6161
use Doctrine\Common\Collections\ArrayCollection;
6262
use Doctrine\ORM\EntityManagerInterface;
63+
use League\Flysystem\Filesystem;
6364
use Psr\EventDispatcher\EventDispatcherInterface;
6465
use Psr\Log\LoggerInterface;
6566
use Symfony\Bundle\FrameworkBundle\Console\Application;
@@ -68,8 +69,11 @@
6869
use Symfony\Component\Console\Tester\CommandTester;
6970
use Symfony\Component\HttpFoundation\RequestStack;
7071
use Symfony\Component\Messenger\MessageBusInterface;
72+
use Symfony\Component\Mime\MimeTypesInterface;
7173
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
7274
use Symfony\Component\Routing\RouterInterface;
75+
use Symfony\Component\Validator\Validator\ValidatorInterface;
76+
use Symfony\Contracts\HttpClient\HttpClientInterface;
7377
use Symfony\Contracts\Translation\TranslatorInterface;
7478

7579
abstract class WebTestCase extends BaseWebTestCase
@@ -178,14 +182,20 @@ public function setUp(): void
178182
$this->kibbyPath = \dirname(__FILE__).'/assets/kibby_emoji.png';
179183
$this->client = static::createClient();
180184

181-
$client = $this->getService(ApHttpClientInterface::class);
182-
self::assertTrue($client instanceof TestingApHttpClient);
183-
$this->testingApHttpClient = $client;
184-
185-
$imageManager = $this->getService(ImageManagerInterface::class);
186-
self::assertTrue($imageManager instanceof TestingImageManager);
187-
$this->imageManager = $imageManager;
185+
$this->testingApHttpClient = new TestingApHttpClient();
186+
self::getContainer()->set(ApHttpClientInterface::class, $this->testingApHttpClient);
187+
188+
$this->imageManager = new TestingImageManager(
189+
$this->getContainer()->getParameter('kbin_storage_url'),
190+
$this->getService(Filesystem::class),
191+
$this->getService(HttpClientInterface::class),
192+
$this->getService(MimeTypesInterface::class),
193+
$this->getService(ValidatorInterface::class),
194+
$this->getService(LoggerInterface::class),
195+
$this->getService(SettingsManager::class),
196+
);
188197
$this->imageManager->setKibbyPath($this->kibbyPath);
198+
self::getContainer()->set(ImageManagerInterface::class, $this->imageManager);
189199

190200
$this->entityManager = $this->getService(EntityManagerInterface::class);
191201
$this->magazineManager = $this->getService(MagazineManager::class);

0 commit comments

Comments
 (0)