Skip to content

Commit

Permalink
rename env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Aug 15, 2024
1 parent 2662e77 commit 4d3cfa4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Alternatively, you may also directly use the highlight component in your markup.

```php
[
'enabled' => env('DOTOO_ENABLED', app()->isLocal()),
'enabled' => env('MAGIC_TODO_ENABLED', app()->isLocal()),
'open' => 'TODO:',
'close' => 'ENDTODO',
];
Expand Down
2 changes: 1 addition & 1 deletion config/magic-todo.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'enabled' => env('DOTOO_ENABLED', app()->isLocal()),
'enabled' => env('MAGIC_TODO_ENABLED', app()->isLocal()),
'open' => '|TODO',
'close' => '|ENDTODO',
];
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
</include>
</source>
<php>
<env name="DOTOO_ENABLED" value="true"/>
<env name="MAGIC_TODO_ENABLED" value="true"/>
</php>
</phpunit>
6 changes: 3 additions & 3 deletions src/InjectAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __invoke(RequestHandled $handled)
}

// Skip if core was included before
if (str_contains($html, '<!--[DOTOO-ASSETS]-->')) {
if (str_contains($html, '<!--[MAGIC_TODO-ASSETS]-->')) {
return;
}

Expand All @@ -39,10 +39,10 @@ public function __invoke(RequestHandled $handled)

$handled->response->setContent(
$this->injectAssets($html, <<< HTML
<!--[DOTOO-ASSETS]-->
<!--[MAGIC_TODO-ASSETS]-->
<script type="module">{$js}</script>
<style>{$css}</style>
<!--[ENDDOTOO]-->
<!--[ENDMAGIC_TODO]-->
HTML)
);

Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/InjectsAssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

$this->get('test-inject-in-response')
->assertOk()
->assertSee('<!--[DOTOO-ASSETS]-->', false);
->assertSee('<!--[MAGIC_TODO-ASSETS]-->', false);
});

it('injects assets into html body when no head tag is present', function () {
Route::get('test-inject-in-response', fn () => '<html></html>');

$this->get('test-inject-in-response')
->assertOk()
->assertSee('<!--[DOTOO-ASSETS]-->', false);
->assertSee('<!--[MAGIC_TODO-ASSETS]-->', false);
});

it('doesnt inject assets into responses without a closing html tag', function () {
Route::get('test-inject-in-response', fn () => 'OK');

$this->get('test-inject-in-response')
->assertOk()
->assertDontSee('<!--[DOTOO-ASSETS]-->', false);
->assertDontSee('<!--[MAGIC_TODO-ASSETS]-->', false);
});

0 comments on commit 4d3cfa4

Please sign in to comment.