From 7d6e3df358c6540610fac3f945923c6a4761331e Mon Sep 17 00:00:00 2001 From: Kai Dederichs Date: Tue, 17 Dec 2024 19:41:38 +0100 Subject: [PATCH] chore: add test to check if big int datatype messes with the proxy --- tests/Fixture/Entity/BigIntEntity.php | 40 +++++++++++++++++++ .../Fixture/Factories/BigIntProxyFactory.php | 34 ++++++++++++++++ tests/Integration/ORM/BigIntProxyTest.php | 19 +++++++++ 3 files changed, 93 insertions(+) create mode 100644 tests/Fixture/Entity/BigIntEntity.php create mode 100644 tests/Fixture/Factories/BigIntProxyFactory.php create mode 100644 tests/Integration/ORM/BigIntProxyTest.php diff --git a/tests/Fixture/Entity/BigIntEntity.php b/tests/Fixture/Entity/BigIntEntity.php new file mode 100644 index 00000000..9c28a460 --- /dev/null +++ b/tests/Fixture/Entity/BigIntEntity.php @@ -0,0 +1,40 @@ + "0"])] + private ?string $bigIntVal = '0'; + + public function getBigIntVal(): ?string + { + return $this->bigIntVal; + } + + public function setBigIntVal(?string $bigIntVal): BigIntEntity + { + $this->bigIntVal = $bigIntVal; + return $this; + } + + public function getId(): ?int + { + return $this->id; + } + + public function setId(?int $id): BigIntEntity + { + $this->id = $id; + return $this; + } +} diff --git a/tests/Fixture/Factories/BigIntProxyFactory.php b/tests/Fixture/Factories/BigIntProxyFactory.php new file mode 100644 index 00000000..bc51711f --- /dev/null +++ b/tests/Fixture/Factories/BigIntProxyFactory.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\Factories; + +use Zenstruck\Foundry\Tests\Fixture\Entity\BigIntEntity; +use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory; + +/** + * @author Kevin Bond + * + * @extends PersistentProxyObjectFactory + */ +final class BigIntProxyFactory extends PersistentProxyObjectFactory +{ + protected function defaults(): array + { + return [ + ]; + } + + public static function class(): string + { + return BigIntEntity::class; + } +} diff --git a/tests/Integration/ORM/BigIntProxyTest.php b/tests/Integration/ORM/BigIntProxyTest.php new file mode 100644 index 00000000..f2d8c089 --- /dev/null +++ b/tests/Integration/ORM/BigIntProxyTest.php @@ -0,0 +1,19 @@ +getId()); + } +}