Skip to content

Commit bc1349a

Browse files
committed
add test wip
1 parent f3e67c7 commit bc1349a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Tests;
6+
7+
use App\Models\Planet;
8+
use MongoDB\Laravel\Tests\TestCase;
9+
10+
class SchemaVersionTest extends TestCase
11+
{
12+
/**
13+
* @runInSeparateProcess
14+
* @preserveGlobalState disabled
15+
*/
16+
public function testSchemaVersion(): void
17+
{
18+
require_once __DIR__ . '/PlanetSchemaVersion.php';
19+
20+
Planet::truncate();
21+
22+
$saturn = Planet::create([
23+
'name' => 'Saturn',
24+
'type' => 'gas',
25+
]);
26+
27+
$wasp = Planet::create([
28+
'name' => 'WASP-39 b',
29+
'type' => 'gas',
30+
'schema_version' => 1,
31+
]);
32+
33+
$planets = Planet::where('type', 'gas')
34+
->get();
35+
echo 'After migration:\n' . $planets[0];
36+
37+
$this->assertCount(2, $planets);
38+
$this->assertEquals(2, $planets[0]->schema_version);
39+
}
40+
}

0 commit comments

Comments
 (0)