|
60 | 60 | use App\Tests\Service\TestingImageManager; |
61 | 61 | use Doctrine\Common\Collections\ArrayCollection; |
62 | 62 | use Doctrine\ORM\EntityManagerInterface; |
| 63 | +use League\Flysystem\Filesystem; |
63 | 64 | use Psr\EventDispatcher\EventDispatcherInterface; |
64 | 65 | use Psr\Log\LoggerInterface; |
65 | 66 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
|
68 | 69 | use Symfony\Component\Console\Tester\CommandTester; |
69 | 70 | use Symfony\Component\HttpFoundation\RequestStack; |
70 | 71 | use Symfony\Component\Messenger\MessageBusInterface; |
| 72 | +use Symfony\Component\Mime\MimeTypesInterface; |
71 | 73 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
72 | 74 | use Symfony\Component\Routing\RouterInterface; |
| 75 | +use Symfony\Component\Validator\Validator\ValidatorInterface; |
| 76 | +use Symfony\Contracts\HttpClient\HttpClientInterface; |
73 | 77 | use Symfony\Contracts\Translation\TranslatorInterface; |
74 | 78 |
|
75 | 79 | abstract class WebTestCase extends BaseWebTestCase |
@@ -178,14 +182,20 @@ public function setUp(): void |
178 | 182 | $this->kibbyPath = \dirname(__FILE__).'/assets/kibby_emoji.png'; |
179 | 183 | $this->client = static::createClient(); |
180 | 184 |
|
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 | + ); |
188 | 197 | $this->imageManager->setKibbyPath($this->kibbyPath); |
| 198 | + self::getContainer()->set(ImageManagerInterface::class, $this->imageManager); |
189 | 199 |
|
190 | 200 | $this->entityManager = $this->getService(EntityManagerInterface::class); |
191 | 201 | $this->magazineManager = $this->getService(MagazineManager::class); |
|
0 commit comments