mirror of
https://github.com/danog/AsyncOrm.git
synced 2024-11-26 12:24:59 +01:00
Test more migrations
This commit is contained in:
parent
b6a82d17ce
commit
e2981bbefd
@ -148,6 +148,12 @@ final class OrmTest extends TestCase
|
||||
$orm = $field->build();
|
||||
$orm[$key] = $value;
|
||||
|
||||
[$a, $b] = await([
|
||||
async($orm->get(...), $key),
|
||||
async($orm->get(...), $key),
|
||||
]);
|
||||
$this->assertSameNotObject($value, $a);
|
||||
$this->assertSameNotObject($value, $b);
|
||||
$this->assertSameNotObject($value, $orm[$key]);
|
||||
$this->assertTrue(isset($orm[$key]));
|
||||
if (!$value instanceof DbObject) {
|
||||
@ -208,6 +214,8 @@ final class OrmTest extends TestCase
|
||||
$this->assertCount(0, $orm);
|
||||
$orm[$key] = $value;
|
||||
$this->assertCount(1, $orm);
|
||||
$orm[$key] = $value;
|
||||
$this->assertCount(1, $orm);
|
||||
$cnt = 0;
|
||||
foreach ($orm as $kk => $vv) {
|
||||
$cnt++;
|
||||
@ -303,6 +311,25 @@ final class OrmTest extends TestCase
|
||||
$this->assertSame(123, $vv);
|
||||
}
|
||||
$this->assertEquals(1, $cnt);
|
||||
|
||||
|
||||
$field = new FieldConfig(
|
||||
$table.'_new',
|
||||
$settings,
|
||||
KeyType::INT,
|
||||
ValueType::INT
|
||||
);
|
||||
$orm = $field->build($orm);
|
||||
$this->assertSame(123, $orm[321]);
|
||||
$this->assertTrue(isset($orm[321]));
|
||||
|
||||
$cnt = 0;
|
||||
foreach ($orm as $kk => $vv) {
|
||||
$cnt++;
|
||||
$this->assertSame(321, $kk);
|
||||
$this->assertSame(123, $vv);
|
||||
}
|
||||
$this->assertEquals(1, $cnt);
|
||||
}
|
||||
|
||||
#[DataProvider('provideSettings')]
|
||||
|
Loading…
Reference in New Issue
Block a user