-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test to check if big int datatype messes with the proxy
- Loading branch information
1 parent
1db5ced
commit 7d6e3df
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Zenstruck\Foundry\Tests\Fixture\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use Zenstruck\Foundry\Tests\Fixture\Model\Base; | ||
|
||
#[ORM\Entity] | ||
class BigIntEntity extends Base | ||
{ | ||
|
||
#[ORM\Id] | ||
#[ORM\Column] | ||
public ?int $id = 1; | ||
|
||
#[ORM\Column(type: 'bigint', nullable: false, options: ['default' => "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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the zenstruck/foundry package. | ||
* | ||
* (c) Kevin Bond <[email protected]> | ||
* | ||
* 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 <[email protected]> | ||
* | ||
* @extends PersistentProxyObjectFactory<BigIntEntity> | ||
*/ | ||
final class BigIntProxyFactory extends PersistentProxyObjectFactory | ||
{ | ||
protected function defaults(): array | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public static function class(): string | ||
{ | ||
return BigIntEntity::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Integration\ORM; | ||
|
||
use Zenstruck\Foundry\Tests\Fixture\Factories\BigIntProxyFactory; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Zenstruck\Foundry\Test\Factories; | ||
use Zenstruck\Foundry\Tests\Integration\RequiresORM; | ||
|
||
final class BigIntProxyTest extends KernelTestCase | ||
{ | ||
use Factories, RequiresORM; | ||
|
||
public function testItDoesNotChangeTheEntity(): void | ||
{ | ||
$entity = BigIntProxyFactory::createOne(); | ||
self::assertEquals(1, $entity->getId()); | ||
} | ||
} |