Skip to content

Commit

Permalink
minor: fix foundry deprecations (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond authored Oct 28, 2024
1 parent d12d0da commit b2492da
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"symfony/phpunit-bridge": "^6.0|^7.0",
"symfony/translation": "^5.4|^6.0|^7.0",
"symfony/validator": "^5.4|^6.0|^7.0",
"zenstruck/foundry": "^1.36",
"zenstruck/foundry": "^1.38.3",
"phpunit/phpunit": "9.6.13",
"zenstruck/browser": "^1.6"
},
Expand Down
3 changes: 1 addition & 2 deletions tests/Functional/NotFoundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;
use Zenstruck\RedirectBundle\Tests\Fixture\Entity\DummyNotFound;

use function Zenstruck\Foundry\repository;
use function Zenstruck\Foundry\Persistence\repository;

/**
* @author Kevin Bond <[email protected]>
Expand Down
7 changes: 3 additions & 4 deletions tests/Functional/RedirectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;
use Zenstruck\RedirectBundle\Tests\Fixture\Entity\DummyRedirect;

use function Zenstruck\Foundry\create;
use function Zenstruck\Foundry\Persistence\persist_proxy;

/**
* @author Kevin Bond <[email protected]>
Expand All @@ -31,7 +30,7 @@ final class RedirectTest extends KernelTestCase
*/
public function permanent_redirect(): void
{
$redirect = create(DummyRedirect::class, ['source' => '/301-redirect', 'destination' => '/']);
$redirect = persist_proxy(DummyRedirect::class, ['source' => '/301-redirect', 'destination' => '/']);
$browser = $this->browser()->interceptRedirects();

$this->assertSame(0, $redirect->getCount());
Expand All @@ -56,7 +55,7 @@ public function permanent_redirect(): void
*/
public function temporary_redirect(): void
{
$redirect = create(DummyRedirect::class, [
$redirect = persist_proxy(DummyRedirect::class, [
'source' => '/302-redirect',
'destination' => '/',
'permanent' => false,
Expand Down
13 changes: 7 additions & 6 deletions tests/Functional/RemoveNotFoundSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
use Zenstruck\Foundry\Test\ResetDatabase;
use Zenstruck\RedirectBundle\Tests\Fixture\Entity\DummyNotFound;
use Zenstruck\RedirectBundle\Tests\Fixture\Entity\DummyRedirect;
use function Zenstruck\Foundry\Persistence\persist;
use function Zenstruck\Foundry\Persistence\persist_proxy;
use function Zenstruck\Foundry\Persistence\repository;

use function Zenstruck\Foundry\create;
use function Zenstruck\Foundry\repository;

/**
* @author Kevin Bond <[email protected]>
Expand All @@ -35,7 +36,7 @@ public function delete_not_found_on_create_redirect(): void
{
$notFoundRepo = repository(DummyNotFound::class);

create(DummyNotFound::class, ['path' => '/foo', 'fullUrl' => '/foo']);
persist(DummyNotFound::class, ['path' => '/foo', 'fullUrl' => '/foo']);

$notFoundRepo->assert()->count(1);

Expand All @@ -53,14 +54,14 @@ public function delete_not_found_on_update_redirect(): void
{
$notFoundRepo = repository(DummyNotFound::class);

create(DummyNotFound::class, ['path' => '/foo', 'fullUrl' => '/foo']);
persist(DummyNotFound::class, ['path' => '/foo', 'fullUrl' => '/foo']);

$redirect = create(DummyRedirect::class, ['source' => '/baz', 'destination' => '/bar']);
$redirect = persist_proxy(DummyRedirect::class, ['source' => '/baz', 'destination' => '/bar']);

$notFoundRepo->assert()->count(1);

$redirect->setSource('/foo');
$redirect->save();
$redirect->_save();

$notFoundRepo->assert()->empty();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Functional/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
use Zenstruck\Foundry\Test\ResetDatabase;
use Zenstruck\RedirectBundle\Tests\Fixture\Entity\DummyRedirect;

use function Zenstruck\Foundry\create;
use function Zenstruck\Foundry\Persistence\persist;


/**
* @author Kevin Bond <[email protected]>
Expand All @@ -31,7 +32,7 @@ final class ValidationTest extends KernelTestCase
*/
public function validation(): void
{
create(DummyRedirect::class, ['source' => '/301-redirect', 'destination' => '/bar']);
persist(DummyRedirect::class, ['source' => '/301-redirect', 'destination' => '/bar']);

/** @var RecursiveValidator $validator */
$validator = self::getContainer()->get('validator');
Expand Down

0 comments on commit b2492da

Please sign in to comment.