diff --git a/tests/ORM/Functional/Driver/Common/Integration/Case321/CaseTest.php b/tests/ORM/Functional/Driver/Common/Integration/Case321/CaseTest.php new file mode 100644 index 00000000..110b98a3 --- /dev/null +++ b/tests/ORM/Functional/Driver/Common/Integration/Case321/CaseTest.php @@ -0,0 +1,61 @@ +makeTables(); + + $this->loadSchema(__DIR__ . '/schema.php'); + } + + public function test1(): void + { + $user = new Entity\User1(); + + // Store changes and calc write queries + $this->captureWriteQueries(); + $this->save($user); + + // Check write queries count + $this->assertNumWrites(1); + } + + public function test2(): void + { + $user = new Entity\User2(); + + // Store changes and calc write queries + $this->captureWriteQueries(); + $this->save($user); + + // Check write queries count + $this->assertNumWrites(1); + } + + private function makeTables(): void + { + // Make tables + $this->makeTable('user1', [ + 'id' => 'primary', // autoincrement + ]); + + $this->makeTable('user2', [ + 'id' => 'primary', // autoincrement + ]); + } +} diff --git a/tests/ORM/Functional/Driver/Common/Integration/Case321/Entity/User1.php b/tests/ORM/Functional/Driver/Common/Integration/Case321/Entity/User1.php new file mode 100644 index 00000000..292e31c5 --- /dev/null +++ b/tests/ORM/Functional/Driver/Common/Integration/Case321/Entity/User1.php @@ -0,0 +1,10 @@ + [ + Schema::ENTITY => User1::class, + Schema::MAPPER => Mapper::class, + Schema::SOURCE => Source::class, + Schema::DATABASE => 'default', + Schema::TABLE => 'user1', + Schema::PRIMARY_KEY => ['id'], + Schema::FIND_BY_KEYS => ['id'], + Schema::COLUMNS => [ + 'id' => 'id', + ], + Schema::RELATIONS => [], + Schema::SCOPE => null, + Schema::TYPECAST => [ + 'id' => 'int', + ], + Schema::SCHEMA => [], + ], + 'user2' => [ + Schema::ENTITY => User2::class, + Schema::MAPPER => Mapper::class, + Schema::SOURCE => Source::class, + Schema::DATABASE => 'default', + Schema::TABLE => 'user2', + Schema::PRIMARY_KEY => ['id'], + Schema::FIND_BY_KEYS => ['id'], + Schema::COLUMNS => [ + 'id' => 'id', + ], + Schema::RELATIONS => [], + Schema::SCOPE => null, + Schema::TYPECAST => [ + 'id' => 'int', + ], + Schema::SCHEMA => [], + ], +]; diff --git a/tests/ORM/Functional/Driver/MySQL/Integration/Case321/CaseTest.php b/tests/ORM/Functional/Driver/MySQL/Integration/Case321/CaseTest.php new file mode 100644 index 00000000..7b3318f0 --- /dev/null +++ b/tests/ORM/Functional/Driver/MySQL/Integration/Case321/CaseTest.php @@ -0,0 +1,17 @@ +