Skip to content

Commit 67822f2

Browse files
committed
refactor: renaming
1 parent d38281f commit 67822f2

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed
File renamed without changes.
File renamed without changes.

scripts/ThemeSwitchTwoStates/ThemeInitScript.php renamed to scripts/ThemeSwitchTwoStates/InitScript.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
use Zmyslny\LaravelInlineScripts\Script\FromFileWithPlaceholders;
88

9-
class ThemeInitScript extends FromFileWithPlaceholders
9+
class InitScript extends FromFileWithPlaceholders
1010
{
11-
protected string $fileName = 'theme-init';
11+
protected string $fileName = 'init';
1212

1313
protected string $fileDirectory = __DIR__.'/../../resources/js/theme-switch-two-states';
1414

scripts/ThemeSwitchTwoStates/ThemeSwitchScript.php renamed to scripts/ThemeSwitchTwoStates/SwitchScript.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
use Throwable;
99
use Zmyslny\LaravelInlineScripts\Script\FromFileWithPlaceholders;
1010

11-
class ThemeSwitchScript extends FromFileWithPlaceholders
11+
class SwitchScript extends FromFileWithPlaceholders
1212
{
1313
public const DEFAULT_KEY = 'd';
1414

1515
public const KEY_PATTERN = '/^[a-z]$/';
1616

17-
protected string $fileName = 'theme-switch';
17+
protected string $fileName = 'switch';
1818

1919
protected string $fileDirectory = __DIR__.'/../../resources/js/theme-switch-two-states';
2020

tests/Unit/BladeInlineScriptsFacadeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
use Zmyslny\LaravelInlineScripts\BladeInlineScriptsCore;
66
use Zmyslny\LaravelInlineScripts\BladeInlineScriptsFacade;
7-
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\ThemeInitScript;
8-
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\ThemeSwitchScript;
7+
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\InitScript;
8+
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\SwitchScript;
99

1010
uses(Tests\TestCase::class);
1111

1212
test('"take" can create BladeInlineScripts instance', function (): void {
1313
// Arrange & Act
1414
$instance = BladeInlineScriptsFacade::take(
15-
new ThemeSwitchScript,
16-
new ThemeInitScript
15+
new SwitchScript,
16+
new InitScript
1717
);
1818

1919
// Assert

tests/Unit/ThemeSwitchTwoStates/ThemeInitScriptTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
declare(strict_types=1);
44

5-
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\ThemeInitScript;
5+
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\InitScript;
66
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\ThemeTypeEnum;
77

88
uses(Tests\TestCase::class);
99

1010
it('points to a real file', function (): void {
1111
// Arrange
12-
$script = new ThemeInitScript();
12+
$script = new InitScript();
1313

1414
// Act
1515
$isValid = $script->isFilePathValid();
@@ -20,7 +20,7 @@
2020

2121
it('returns proper values from getPlaceholders()', function (): void {
2222
// Arrange
23-
$script = new ThemeInitScript();
23+
$script = new InitScript();
2424

2525
// Act
2626
$placeholders = $script->getPlaceholders();

tests/Unit/ThemeSwitchTwoStates/ThemeSwitchScriptTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
declare(strict_types=1);
44

5-
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\ThemeSwitchScript;
5+
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\SwitchScript;
66
use Zmyslny\LaravelInlineScripts\Ready\ThemeSwitchTwoStates\ThemeTypeEnum;
77

88
uses(Tests\TestCase::class);
99

1010
it('points to a real file', function (): void {
1111
// Arrange
12-
$script = new ThemeSwitchScript();
12+
$script = new SwitchScript();
1313

1414
// Act
1515
$isValid = $script->isFilePathValid();
@@ -20,34 +20,34 @@
2020

2121
it('throws an exception when the $key value being set is empty', function (): void {
2222
// Arrange
23-
$script = new ThemeSwitchScript();
23+
$script = new SwitchScript();
2424

2525
// Act & Assert
2626
expect(fn () => $script->setKey(''))
27-
->toThrow(InvalidArgumentException::class, sprintf('Key must be one letter from the %s pattern.', ThemeSwitchScript::KEY_PATTERN));
27+
->toThrow(InvalidArgumentException::class, sprintf('Key must be one letter from the %s pattern.', SwitchScript::KEY_PATTERN));
2828
});
2929

3030
it('throws an exception when the $key value being set is longer than one letter', function (): void {
3131
// Arrange
32-
$script = new ThemeSwitchScript();
32+
$script = new SwitchScript();
3333

3434
// Act & Assert
3535
expect(fn () => $script->setKey('too'))
36-
->toThrow(InvalidArgumentException::class, sprintf('Key must be one letter from the %s pattern.', ThemeSwitchScript::KEY_PATTERN));
36+
->toThrow(InvalidArgumentException::class, sprintf('Key must be one letter from the %s pattern.', SwitchScript::KEY_PATTERN));
3737
});
3838

3939
it('throws an exception when the $key is a single letter but does not match KEY_PATTERN', function (): void {
4040
// Arrange
41-
$script = new ThemeSwitchScript();
41+
$script = new SwitchScript();
4242

4343
// Act & Assert
4444
expect(fn () => $script->setKey('A'))
45-
->toThrow(InvalidArgumentException::class, sprintf('Key must be one letter from the %s pattern.', ThemeSwitchScript::KEY_PATTERN));
45+
->toThrow(InvalidArgumentException::class, sprintf('Key must be one letter from the %s pattern.', SwitchScript::KEY_PATTERN));
4646
});
4747

4848
it('sets $key correctly for a valid value', function (): void {
4949
// Arrange
50-
$script = new ThemeSwitchScript();
50+
$script = new SwitchScript();
5151

5252
// Act
5353
$script->setKey('t');
@@ -58,15 +58,15 @@
5858

5959
it('sets $key correctly for a valid value through constructor', function (): void {
6060
// Arrange & Act
61-
$script = new ThemeSwitchScript('t');
61+
$script = new SwitchScript('t');
6262

6363
// Assert
6464
expect($script->getKey())->toBe('t');
6565
});
6666

6767
it('returns proper values from getPlaceholders()', function (): void {
6868
// Arrange
69-
$script = new ThemeSwitchScript();
69+
$script = new SwitchScript();
7070
$script->setKey('k');
7171

7272
// Act

tests/js/theme-switch-two-states/theme-init.test.js renamed to tests/js/theme-switch-two-states/init.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from "node:fs";
33
import path from "node:path";
44

55
// Path to the raw JS template (with placeholders) used by PHP to generate a runtime script
6-
const scriptPath = path.resolve(process.cwd(), "resources/js/theme-switch-two-states/theme-init.js");
6+
const scriptPath = path.resolve(process.cwd(), "resources/js/theme-switch-two-states/init.js");
77

88
const DEFAULT_DARK = "dark";
99
const DEFAULT_LIGHT = "light";

tests/js/theme-switch-two-states/theme-switch.test.js renamed to tests/js/theme-switch-two-states/switch.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from "node:fs";
33
import path from "node:path";
44

55
// Path to the raw JS template (with placeholders) used by PHP to generate a runtime script
6-
const scriptPath = path.resolve(process.cwd(), "resources/js/theme-switch-two-states/theme-switch.js");
6+
const scriptPath = path.resolve(process.cwd(), "resources/js/theme-switch-two-states/switch.js");
77

88
const DEFAULT_TOGGLE_KEY = "d";
99
const DEFAULT_DARK = "dark";

0 commit comments

Comments
 (0)