From e98ea31d41d859c6536bea64143bdf0bb16bf75f Mon Sep 17 00:00:00 2001 From: samuelgfeller Date: Tue, 9 Apr 2024 15:17:36 +0200 Subject: [PATCH] Renamed insertFixtures to prevent confusion --- README.md | 3 ++- src/Trait/DatabaseSchemaTestTrait.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 35a80b6..a91dd6d 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,8 @@ The first parameter is the fixture object, the second is optional and accepts arrays of attributes. An array of attributes contains the data for one database row -e.g. `['field_name' => 'value', 'other_field_name' => 'other_value']`. +e.g.: +`['field_name' => 'value', 'other_field_name' => 'other_value']`. Multiple rows can also be inserted with one function call. Thanks to the argument unpacking operator, diff --git a/src/Trait/DatabaseSchemaTestTrait.php b/src/Trait/DatabaseSchemaTestTrait.php index aec2460..0be9311 100644 --- a/src/Trait/DatabaseSchemaTestTrait.php +++ b/src/Trait/DatabaseSchemaTestTrait.php @@ -32,7 +32,7 @@ protected function setUpDatabase(?string $schemaFile = null): void $this->truncateTables(); if (!empty($this->fixtures)) { - $this->insertFixtures($this->fixtures); + $this->insertDefaultFixtures($this->fixtures); } } @@ -113,9 +113,9 @@ protected function dropTables(): void * * @param string $sql The sql * + * @return PDOStatement The statement * @throws UnexpectedValueException * - * @return PDOStatement The statement */ private function createQueryStatement(string $sql): PDOStatement { @@ -131,9 +131,9 @@ private function createQueryStatement(string $sql): PDOStatement /** * Import table schema. * + * @return void * @throws UnexpectedValueException * - * @return void */ protected function importSchema(): void { @@ -202,7 +202,7 @@ protected function truncateTables(): void * * @return void */ - protected function insertFixtures(array $fixtures): void + protected function insertDefaultFixtures(array $fixtures): void { foreach ($fixtures as $fixture) { $object = new $fixture();