-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* PHPORM-35 Add various tests on Model _id * Add assertion on expected value * Test _id as array and object * Remove tests for arrays and objects as identifiers when keyType is string --------- Co-authored-by: Andreas Braun <git@alcaeus.org>
- Loading branch information
Showing
4 changed files
with
150 additions
and
4 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
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,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jenssegers\Mongodb\Tests\Models; | ||
|
||
use Jenssegers\Mongodb\Eloquent\Casts\BinaryUuid; | ||
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; | ||
|
||
class IdIsBinaryUuid extends Eloquent | ||
{ | ||
protected $connection = 'mongodb'; | ||
protected static $unguarded = true; | ||
protected $casts = [ | ||
'_id' => BinaryUuid::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,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jenssegers\Mongodb\Tests\Models; | ||
|
||
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; | ||
|
||
class IdIsInt extends Eloquent | ||
{ | ||
protected $keyType = 'int'; | ||
protected $connection = 'mongodb'; | ||
protected static $unguarded = true; | ||
protected $casts = [ | ||
'_id' => 'int', | ||
]; | ||
} |
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jenssegers\Mongodb\Tests\Models; | ||
|
||
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; | ||
|
||
class IdIsString extends Eloquent | ||
{ | ||
protected $connection = 'mongodb'; | ||
protected static $unguarded = true; | ||
protected $casts = [ | ||
'_id' => 'string', | ||
]; | ||
} |