Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Test Generator #20

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

[WIP] Test Generator #20

wants to merge 17 commits into from

Conversation

HelgeSverre
Copy link
Member

No description provided.

…d through NameHelper methods.

# Aider chat conversation:

USER: in the `src/Stubs/pest-resource-test-func.stub` and maybe `src/Stubs/pest-resource-test.stub` the connector name should be passed through `tests/Unit/Helpers/NameHelperTest.php` safeVariableName

ASSISTANT: To address the request, I will make the following changes:

1. In `src/Stubs/pest-resource-test-func.stub`, I will modify the `{{ name }}` placeholder within the `$this->{{ name }}->{{ resourceName }}()->{{ methodName }}();` line to be passed through the `NameHelper::safeVariableName` method.
2. In `src/Stubs/pest-resource-test.stub`, I will modify the `{{ name }}` placeholder within the `$this->{{ name }} = new {{ namespace }}\{{ name }}( /* todo */);` line to be passed through the `NameHelper::safeVariableName` method.

Here are the diffs for those changes:

```diff
--- src/Stubs/pest-resource-test-func.stub
+++ src/Stubs/pest-resource-test-func.stub
@@ ... @@
 it('{{ testDescription }}', function () {
     Saloon::fake([
         {{ requestClass }}::class => MockResponse::fixture('{{ fixtureName }}'),
     ]);

-    $response = $this->{{ name }}->{{ resourceName }}()->{{ methodName }}();
+    $response = $this->{{ safeVariableName }}->{{ resourceName }}()->{{ methodName }}();

     Saloon::assertSent({{ requestClass }}::class);

     expect($response->status())->toBe(200);
 });
```

```diff
--- src/Stubs/pest-resource-test.stub
+++ src/Stubs/pest-resource-test.stub
@@ ... @@
 beforeEach(function () {
-    $this->{{ name }} = new {{ namespace }}\{{ name }}( /* todo */);
+    $this->{{ safeVariableName }} = new {{ namespace }}\{{ safeClassName }}( /* todo */);
 });
```

Please note that in the second diff, I have also assumed that the `{{ name }}` placeholder within the `new {{ namespace }}\{{ name }}` part should be passed through the `NameHelper::safeClassName` method, as it seems to be a class instantiation. If this assumption is incorrect, please let me know, and I will adjust the diff accordingly.
…be passed through NameHelper methods."

This reverts commit 445ddf4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant