Skip to content

Commit

Permalink
Rename enum cases to match suggested formatting (RFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mārtiņš Briedis committed Dec 6, 2024
1 parent 047d68c commit 4b4eb9d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions tests/framework/behaviors/AttributeTypecastBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -112,7 +112,7 @@ public function testTypecastEnumFromString()

$model->getAttributeTypecastBehavior()->typecastAttributes();

$this->assertSame(StatusTypeString::ACTIVE, $model->status);
$this->assertSame(StatusTypeString::Active, $model->status);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/framework/db/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions tests/framework/db/enums/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

enum Status
{
case ACTIVE;
case INACTIVE;
case Active;
case Inactive;
}
4 changes: 2 additions & 2 deletions tests/framework/db/enums/StatusTypeInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

enum StatusTypeInt: int
{
case ACTIVE = 1;
case INACTIVE = 0;
case Active = 1;
case Inactive = 0;
}
4 changes: 2 additions & 2 deletions tests/framework/db/enums/StatusTypeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

enum StatusTypeString: string
{
case ACTIVE = 'active';
case INACTIVE = 'inactive';
case Active = 'active';
case Inactive = 'inactive';
}

0 comments on commit 4b4eb9d

Please sign in to comment.