diff --git a/tests/framework/behaviors/AttributeTypecastBehaviorTest.php b/tests/framework/behaviors/AttributeTypecastBehaviorTest.php index 124dd483f74..27c228dea2c 100644 --- a/tests/framework/behaviors/AttributeTypecastBehaviorTest.php +++ b/tests/framework/behaviors/AttributeTypecastBehaviorTest.php @@ -91,11 +91,11 @@ public function testTypecastEnum() $model = new ActiveRecordAttributeTypecastWithEnum(); - $model->status = StatusTypeString::ACTIVE; + $model->status = StatusTypeString::Active; $model->getAttributeTypecastBehavior()->typecastAttributes(); - $this->assertSame(StatusTypeString::ACTIVE, $model->status); + $this->assertSame(StatusTypeString::Active, $model->status); } /** @@ -112,7 +112,7 @@ public function testTypecastEnumFromString() $model->getAttributeTypecastBehavior()->typecastAttributes(); - $this->assertSame(StatusTypeString::ACTIVE, $model->status); + $this->assertSame(StatusTypeString::Active, $model->status); } /** diff --git a/tests/framework/db/CommandTest.php b/tests/framework/db/CommandTest.php index cd3ecc6d686..cc30d748860 100644 --- a/tests/framework/db/CommandTest.php +++ b/tests/framework/db/CommandTest.php @@ -1538,13 +1538,13 @@ public function testBindValuesSupportsEnums() $db = $this->getConnection(); $command = $db->createCommand(); - $command->setSql('SELECT :p1')->bindValues([':p1' => enums\Status::ACTIVE]); + $command->setSql('SELECT :p1')->bindValues([':p1' => enums\Status::Active]); $this->assertSame('ACTIVE', $command->params[':p1']); - $command->setSql('SELECT :p1')->bindValues([':p1' => enums\StatusTypeString::ACTIVE]); + $command->setSql('SELECT :p1')->bindValues([':p1' => enums\StatusTypeString::Active]); $this->assertSame('active', $command->params[':p1']); - $command->setSql('SELECT :p1')->bindValues([':p1' => enums\StatusTypeInt::ACTIVE]); + $command->setSql('SELECT :p1')->bindValues([':p1' => enums\StatusTypeInt::Active]); $this->assertSame(1, $command->params[':p1']); } else { $this->markTestSkipped('Enums are not supported in PHP < 8.1'); diff --git a/tests/framework/db/enums/Status.php b/tests/framework/db/enums/Status.php index 799a552319b..13235e730bc 100644 --- a/tests/framework/db/enums/Status.php +++ b/tests/framework/db/enums/Status.php @@ -4,6 +4,6 @@ enum Status { - case ACTIVE; - case INACTIVE; + case Active; + case Inactive; } diff --git a/tests/framework/db/enums/StatusTypeInt.php b/tests/framework/db/enums/StatusTypeInt.php index ed4739c0227..7a8d539c523 100644 --- a/tests/framework/db/enums/StatusTypeInt.php +++ b/tests/framework/db/enums/StatusTypeInt.php @@ -4,6 +4,6 @@ enum StatusTypeInt: int { - case ACTIVE = 1; - case INACTIVE = 0; + case Active = 1; + case Inactive = 0; } diff --git a/tests/framework/db/enums/StatusTypeString.php b/tests/framework/db/enums/StatusTypeString.php index 019f4273a7f..9f8f2af9979 100644 --- a/tests/framework/db/enums/StatusTypeString.php +++ b/tests/framework/db/enums/StatusTypeString.php @@ -4,6 +4,6 @@ enum StatusTypeString: string { - case ACTIVE = 'active'; - case INACTIVE = 'inactive'; + case Active = 'active'; + case Inactive = 'inactive'; }