From 784bbc147a46912eb67dde76caf74c0e36f26a36 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 15 Dec 2024 20:31:30 +0800 Subject: [PATCH 1/6] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/FluentDecoratorTest.php | 82 +++++++++++++++++++++------ 1 file changed, 66 insertions(+), 16 deletions(-) diff --git a/tests/Support/FluentDecoratorTest.php b/tests/Support/FluentDecoratorTest.php index 987cac73..3cb80dbe 100644 --- a/tests/Support/FluentDecoratorTest.php +++ b/tests/Support/FluentDecoratorTest.php @@ -9,12 +9,9 @@ class FluentDecoratorTest extends TestCase { /** @test */ - public function it_can_be_utilise_fluent_features() + public function it_can_utilise_fluent_features() { - $fluent = new class($attributes = ['testbench' => true, 'class' => __CLASS__]) extends FluentDecorator - { - // ... - }; + [$fluent, $attributes] = $this->newFluent(); $this->assertTrue(isset($fluent['testbench'])); $this->assertTrue(isset($fluent['class'])); @@ -27,30 +24,83 @@ public function it_can_be_utilise_fluent_features() $this->assertSame($attributes, $fluent->toArray()); $this->assertSame(json_encode($attributes), $fluent->toJson()); $this->assertSame($attributes, $fluent->jsonSerialize()); + } + + /** @test */ + public function it_can_utilise_fluent_as_object() + { + [$fluent] = $this->newFluent(); + + $this->assertFalse(isset($fluent->laravel)); + $this->assertFalse(isset($fluent->file)); + $this->assertNull($fluent->laravel); + $this->assertNull($fluent->file); + + $fluent->laravel = Application::VERSION; + $fluent->file = __FILE__; + + $this->assertTrue(isset($fluent->laravel)); + $this->assertTrue(isset($fluent->file)); + $this->assertSame(Application::VERSION, $fluent->laravel); + $this->assertSame(__FILE__, $fluent->file); + + unset($fluent->file); + $this->assertTrue(isset($fluent->laravel)); + $this->assertFalse(isset($fluent->file)); + } + /** @test */ + public function it_can_utilise_fluent_as_array() + { + [$fluent] = $this->newFluent(); + $this->assertFalse(isset($fluent['laravel'])); + $this->assertFalse(isset($fluent['file'])); $this->assertNull($fluent['laravel']); + $this->assertNull($fluent['file']); - $this->assertInstanceOf(FluentDecorator::class, $fluent->laravel(Application::VERSION)); + $fluent['laravel'] = Application::VERSION; + $fluent['file'] = __FILE__; $this->assertTrue(isset($fluent['laravel'])); + $this->assertTrue(isset($fluent['file'])); $this->assertSame(Application::VERSION, $fluent['laravel']); + $this->assertSame(__FILE__, $fluent['file']); - unset($fluent['class']); + unset($fluent['file']); - $this->assertFalse(isset($fluent['class'])); - $this->assertFalse(isset($fluent->class)); - $this->assertNull($fluent['class']); - $this->assertNull($fluent->class); + $this->assertTrue(isset($fluent['laravel'])); + $this->assertFalse(isset($fluent['file'])); + } - $this->assertFalse(isset($fluent->file)); + /** @test */ + public function it_can_set_fluent_attribute_using_method_call() + { + [$fluent] = $this->newFluent(); - $fluent->file = __FILE__; + $this->assertFalse(isset($fluent['laravel'])); + $this->assertNull($fluent['laravel']); - $this->assertTrue(isset($fluent->file)); + $this->assertInstanceOf(FluentDecorator::class, $fluent->laravel(Application::VERSION)); - unset($fluent->file); + $this->assertTrue(isset($fluent['laravel'])); + $this->assertSame(Application::VERSION, $fluent['laravel']); + } - $this->assertFalse(isset($fluent->file)); + /** + * Create new test stubs. + * + * @return array{0: \Orchestra\Testbench\Support\FluentDecorator, 1: array} + */ + protected function newFluent(): array + { + $attributes = ['testbench' => true, 'class' => __CLASS__]; + + return [ + new class($attributes) extends FluentDecorator { + // ... + }, + $attributes, + ]; } } From c9a4e0b607590699f7d20505bb605e7503b0a59d Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 15 Dec 2024 20:33:34 +0800 Subject: [PATCH 2/6] wip Signed-off-by: Mior Muhammad Zaki --- tests/Support/FluentDecoratorTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Support/FluentDecoratorTest.php b/tests/Support/FluentDecoratorTest.php index 3cb80dbe..2ce29726 100644 --- a/tests/Support/FluentDecoratorTest.php +++ b/tests/Support/FluentDecoratorTest.php @@ -30,7 +30,7 @@ public function it_can_utilise_fluent_features() public function it_can_utilise_fluent_as_object() { [$fluent] = $this->newFluent(); - + $this->assertFalse(isset($fluent->laravel)); $this->assertFalse(isset($fluent->file)); $this->assertNull($fluent->laravel); @@ -49,11 +49,12 @@ public function it_can_utilise_fluent_as_object() $this->assertTrue(isset($fluent->laravel)); $this->assertFalse(isset($fluent->file)); } + /** @test */ public function it_can_utilise_fluent_as_array() { [$fluent] = $this->newFluent(); - + $this->assertFalse(isset($fluent['laravel'])); $this->assertFalse(isset($fluent['file'])); $this->assertNull($fluent['laravel']); @@ -89,7 +90,7 @@ public function it_can_set_fluent_attribute_using_method_call() /** * Create new test stubs. - * + * * @return array{0: \Orchestra\Testbench\Support\FluentDecorator, 1: array} */ protected function newFluent(): array @@ -97,7 +98,8 @@ protected function newFluent(): array $attributes = ['testbench' => true, 'class' => __CLASS__]; return [ - new class($attributes) extends FluentDecorator { + new class($attributes) extends FluentDecorator + { // ... }, $attributes, From b82e20e96bf5efd2e4ce4bf8eb5fbc0e6965fdbd Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 15 Dec 2024 21:54:37 +0800 Subject: [PATCH 3/6] wip Signed-off-by: Mior Muhammad Zaki --- src/Support/FluentDecorator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Support/FluentDecorator.php b/src/Support/FluentDecorator.php index 15d57660..4c75a501 100644 --- a/src/Support/FluentDecorator.php +++ b/src/Support/FluentDecorator.php @@ -10,6 +10,8 @@ use JsonSerializable; /** + * @api + * * @template TKey of array-key * @template TValue * From 1ff0ec7f0ab655b501990bf578a1c2313cbdb26c Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 15 Dec 2024 21:54:47 +0800 Subject: [PATCH 4/6] wip Signed-off-by: Mior Muhammad Zaki --- src/Support/FluentDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/FluentDecorator.php b/src/Support/FluentDecorator.php index 4c75a501..bee6f66f 100644 --- a/src/Support/FluentDecorator.php +++ b/src/Support/FluentDecorator.php @@ -10,7 +10,7 @@ use JsonSerializable; /** - * @api + * @internal * * @template TKey of array-key * @template TValue From 97ce94c26fa00566d9ff0e27ae9f022ded88e494 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 15 Dec 2024 21:57:19 +0800 Subject: [PATCH 5/6] wip Signed-off-by: Mior Muhammad Zaki --- src/Support/PhpExecutableFinder.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Support/PhpExecutableFinder.php b/src/Support/PhpExecutableFinder.php index 7b5fde3b..e41bf273 100644 --- a/src/Support/PhpExecutableFinder.php +++ b/src/Support/PhpExecutableFinder.php @@ -7,6 +7,9 @@ use function Orchestra\Testbench\join_paths; +/** + * @internal + */ class PhpExecutableFinder extends SymfonyPhpExecutableFinder { /** From 0c8fb3776c7239ca95adbef5035c0d55719354cb Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 15 Dec 2024 22:03:33 +0800 Subject: [PATCH 6/6] Release 7.50.0 Signed-off-by: Mior Muhammad Zaki --- CHANGELOG-7.x.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG-7.x.md b/CHANGELOG-7.x.md index cc20d9b3..65b081ad 100644 --- a/CHANGELOG-7.x.md +++ b/CHANGELOG-7.x.md @@ -2,6 +2,19 @@ This changelog references the relevant changes (bug and security fixes) done to `orchestra/testbench-core`. +## 7.50.0 + +Released: 2024-12-15 + +### Added + +* Added `Orchestra\Testbench\transform_realpath_to_relative()` function. +* Override Laravel's `vendor:publish` command. + +### Changes + +* Add `$force` parameter to `Orchestra\Testbench\Workbench\Workbench::detectNamespace()` method. + ## 7.49.1 Released: 2024-12-14