chore: code refactor via rector
This commit is contained in:
@@ -18,12 +18,10 @@ class ColorPickerTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->testModel = new TestModel;
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_returns_correct_colors_for_uppercase_letters()
|
||||
public function it_returns_correct_colors_for_uppercase_letters(): void
|
||||
{
|
||||
$this->assertEquals([
|
||||
'dark' => 'dark:bg-amber-500',
|
||||
@@ -37,7 +35,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_handles_lowercase_letters_correctly()
|
||||
public function it_handles_lowercase_letters_correctly(): void
|
||||
{
|
||||
$this->assertEquals([
|
||||
'dark' => 'dark:bg-amber-500',
|
||||
@@ -51,7 +49,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_returns_default_gray_color_for_invalid_letters()
|
||||
public function it_returns_default_gray_color_for_invalid_letters(): void
|
||||
{
|
||||
$this->assertEquals([
|
||||
'dark' => 'dark:bg-gray-500',
|
||||
@@ -70,7 +68,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_handles_special_characters()
|
||||
public function it_handles_special_characters(): void
|
||||
{
|
||||
$this->assertEquals([
|
||||
'dark' => 'dark:bg-gray-500',
|
||||
@@ -84,7 +82,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_returns_array_with_dark_and_light_keys()
|
||||
public function it_returns_array_with_dark_and_light_keys(): void
|
||||
{
|
||||
$colors = TestModel::chooseColor('B');
|
||||
|
||||
@@ -94,7 +92,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_provides_consistent_color_mapping()
|
||||
public function it_provides_consistent_color_mapping(): void
|
||||
{
|
||||
$colorA = TestModel::chooseColor('A');
|
||||
$colorALower = TestModel::chooseColor('a');
|
||||
@@ -103,7 +101,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_covers_all_letters_of_alphabet()
|
||||
public function it_covers_all_letters_of_alphabet(): void
|
||||
{
|
||||
$alphabet = range('A', 'Z');
|
||||
|
||||
@@ -119,7 +117,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_handles_numbers_and_non_alphabetic_characters_gracefully()
|
||||
public function it_handles_numbers_and_non_alphabetic_characters_gracefully(): void
|
||||
{
|
||||
$nonAlphaChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+', '=', '[', ']', '{', '}', '|', '\\', ';', ':', "'", '"', ',', '.', '<', '>', '/', '?', '~', '`'];
|
||||
|
||||
@@ -134,7 +132,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_ensures_all_colors_follow_tailwind_css_naming_convention()
|
||||
public function it_ensures_all_colors_follow_tailwind_css_naming_convention(): void
|
||||
{
|
||||
$alphabet = range('A', 'Z');
|
||||
|
||||
@@ -147,7 +145,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_provides_unique_colors_for_different_letters()
|
||||
public function it_provides_unique_colors_for_different_letters(): void
|
||||
{
|
||||
$colorA = TestModel::chooseColor('A');
|
||||
$colorB = TestModel::chooseColor('B');
|
||||
@@ -159,7 +157,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_handles_mixed_case_input()
|
||||
public function it_handles_mixed_case_input(): void
|
||||
{
|
||||
$mixedCaseColors = [
|
||||
TestModel::chooseColor('H'),
|
||||
@@ -174,10 +172,10 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_be_used_in_model_context()
|
||||
public function it_can_be_used_in_model_context(): void
|
||||
{
|
||||
// Test with Email model that uses ColorPicker
|
||||
$email = Email::factory()->create(['from_name' => 'John Doe']);
|
||||
Email::factory()->create(['from_name' => 'John Doe']);
|
||||
|
||||
// This tests that the trait works when used by actual models
|
||||
$colors = ColorPicker::chooseColor('J');
|
||||
@@ -186,7 +184,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_maintains_backward_compatibility()
|
||||
public function it_maintains_backward_compatibility(): void
|
||||
{
|
||||
// Ensure the color mapping remains consistent
|
||||
$expectedColors = [
|
||||
@@ -203,7 +201,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_handles_unicode_characters()
|
||||
public function it_handles_unicode_characters(): void
|
||||
{
|
||||
$unicodeChars = ['ñ', 'ç', 'ü', 'ö', 'ä', 'ß'];
|
||||
|
||||
@@ -218,7 +216,7 @@ class ColorPickerTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_be_called_statically()
|
||||
public function it_can_be_called_statically(): void
|
||||
{
|
||||
// Test both static and instance calling
|
||||
$staticResult = TestModel::chooseColor('X');
|
||||
@@ -226,7 +224,6 @@ class ColorPickerTest extends TestCase
|
||||
$instance = new TestModel;
|
||||
$reflection = new ReflectionClass($instance);
|
||||
$method = $reflection->getMethod('chooseColor');
|
||||
$method->setAccessible(true);
|
||||
$instanceResult = $method->invoke(null, 'X');
|
||||
|
||||
$this->assertEquals($staticResult, $instanceResult);
|
||||
|
||||
Reference in New Issue
Block a user