Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions tests/Fixtures/Blog/PrimaryKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace ShipMonkTests\DoctrineEntityPreloader\Fixtures\Blog;

use function base64_encode;
use function random_int;

class PrimaryKey
{

public const DOCTRINE_TYPE_NAME = 'primary_key';
public const LENGTH_BYTES = 4;

private static int $autoIncrement = 0;

private int $data;

Expand All @@ -20,10 +20,7 @@ public function __construct(int $data)

public static function new(): self
{
$bits = self::LENGTH_BYTES * 8;
$maxValue = (1 << $bits) - 1;

return new self(random_int(0, $maxValue));
return new self(self::$autoIncrement++);
}

public function getData(): int
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Blog/Type/PrimaryKeyBinaryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getSQLDeclaration(
): string
{
return $platform->getBinaryTypeDeclarationSQL([
'length' => PrimaryKey::LENGTH_BYTES,
'length' => 4,
'fixed' => true,
]);
}
Expand Down