Skip to content

Commit 8d9736b

Browse files
committed
CastBinaryUuid merged into Casting;
1 parent 187cfc0 commit 8d9736b

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

tests/Casts/BinaryUuidTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Generator;
88
use MongoDB\BSON\Binary;
9-
use MongoDB\Laravel\Tests\Models\CastBinaryUuid;
9+
use MongoDB\Laravel\Tests\Models\Casting;
1010
use MongoDB\Laravel\Tests\TestCase;
1111

1212
use function hex2bin;
@@ -17,15 +17,15 @@ protected function setUp(): void
1717
{
1818
parent::setUp();
1919

20-
CastBinaryUuid::truncate();
20+
Casting::truncate();
2121
}
2222

2323
/** @dataProvider provideBinaryUuidCast */
2424
public function testBinaryUuidCastModel(string $expectedUuid, string|Binary $saveUuid, Binary $queryUuid): void
2525
{
26-
CastBinaryUuid::create(['uuid' => $saveUuid]);
26+
Casting::create(['uuid' => $saveUuid]);
2727

28-
$model = CastBinaryUuid::firstWhere('uuid', $queryUuid);
28+
$model = Casting::firstWhere('uuid', $queryUuid);
2929
$this->assertNotNull($model);
3030
$this->assertSame($expectedUuid, $model->uuid);
3131
}
@@ -43,9 +43,9 @@ public function testQueryByStringDoesNotCast(): void
4343
{
4444
$uuid = '0c103357-3806-48c9-a84b-867dcb625cfb';
4545

46-
CastBinaryUuid::create(['uuid' => $uuid]);
46+
Casting::create(['uuid' => $uuid]);
4747

48-
$model = CastBinaryUuid::firstWhere('uuid', $uuid);
48+
$model = Casting::firstWhere('uuid', $uuid);
4949
$this->assertNull($model);
5050
}
5151
}

tests/Models/CastBinaryUuid.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/Models/Casting.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace MongoDB\Laravel\Tests\Models;
66

7+
use MongoDB\Laravel\Eloquent\Casts\BinaryUuid;
78
use MongoDB\Laravel\Eloquent\Model as Eloquent;
89

910
class Casting extends Eloquent
@@ -12,6 +13,7 @@ class Casting extends Eloquent
1213
protected $collection = 'casting';
1314

1415
protected $fillable = [
16+
'uuid',
1517
'intNumber',
1618
'floatNumber',
1719
'decimalNumber',
@@ -26,6 +28,7 @@ class Casting extends Eloquent
2628
];
2729

2830
protected $casts = [
31+
'uuid' => BinaryUuid::class,
2932
'intNumber' => 'int',
3033
'floatNumber' => 'float',
3134
'decimalNumber' => 'decimal:2',

0 commit comments

Comments
 (0)