Skip to content

Commit

Permalink
tec: Upgrade to Foundry 2
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Jul 3, 2024
1 parent 6aba189 commit 6fca2d6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 95 deletions.
2 changes: 0 additions & 2 deletions .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonySetList;
use Zenstruck\Foundry\Utils\Rector\FoundrySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
Expand All @@ -25,6 +24,5 @@
SymfonySetList::SYMFONY_63,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
FoundrySetList::UP_TO_FOUNDRY_2,
]);
};
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@
"symfony/phpunit-bridge": "6.4.*",
"symfony/stopwatch": "6.4.*",
"symfony/web-profiler-bundle": "6.4.*",
"zenstruck/foundry": "^1.22"
"zenstruck/foundry": "^2.0"
}
}
118 changes: 32 additions & 86 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/Controller/Tickets/TypeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace App\Tests\Controller\Tickets;

use App\Tests\AuthorizationHelper;
use App\Tests\FactoriesHelper;
use App\Tests\Factory\TicketFactory;
use App\Tests\Factory\UserFactory;
use App\Tests\SessionHelper;
Expand All @@ -20,6 +21,7 @@ class TypeControllerTest extends WebTestCase
{
use AuthorizationHelper;
use Factories;
use FactoriesHelper;
use ResetDatabase;
use SessionHelper;

Expand Down Expand Up @@ -62,6 +64,8 @@ public function testPostUpdateFailsIfTypeIsInvalid(): void
'type' => $newType,
]);

$this->clearEntityManager();

$this->assertResponseRedirects("/tickets/{$ticket->getUid()}", 302);
$client->followRedirect();
$this->assertSelectorTextContains('#notifications', 'Select a type from the list');
Expand Down
8 changes: 5 additions & 3 deletions tests/Security/AuthorizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace App\Tests\Security;

use App\Entity\Authorization;
use App\Repository\AuthorizationRepository;
use App\Security\Authorizer;
use App\Tests\Factory\AuthorizationFactory;
Expand Down Expand Up @@ -38,10 +39,11 @@ public function setupTest(): void
$authorizer = $container->get(Authorizer::class);
$this->authorizer = $authorizer;

/** @var \Zenstruck\Foundry\RepositoryProxy<AuthorizationRepository> */
$authRepositoryProxy = AuthorizationFactory::repository();
/** @var \Doctrine\Bundle\DoctrineBundle\Registry */
$registry = $container->get('doctrine');
$entityManager = $registry->getManager();
/** @var AuthorizationRepository */
$authRepository = $authRepositoryProxy->inner();
$authRepository = $entityManager->getRepository(Authorization::class);
$this->authRepository = $authRepository;
}

Expand Down
8 changes: 5 additions & 3 deletions tests/Service/ActorsListerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace App\Tests\Service;

use App\Entity\Authorization;
use App\Entity\User;
use App\Repository\AuthorizationRepository;
use App\Service\ActorsLister;
Expand Down Expand Up @@ -43,10 +44,11 @@ public function setupTest(): void
$this->currentUser = UserFactory::createOne()->_real();
$client->loginUser($this->currentUser);

/** @var \Zenstruck\Foundry\RepositoryProxy<AuthorizationRepository> */
$authRepositoryProxy = AuthorizationFactory::repository();
/** @var \Doctrine\Bundle\DoctrineBundle\Registry */
$registry = $container->get('doctrine');
$entityManager = $registry->getManager();
/** @var AuthorizationRepository */
$authRepository = $authRepositoryProxy->inner();
$authRepository = $entityManager->getRepository(Authorization::class);
$this->authRepository = $authRepository;
}

Expand Down

0 comments on commit 6fca2d6

Please sign in to comment.