Skip to content

Commit

Permalink
Use more arrow functions in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Jun 8, 2024
1 parent 13ed5ec commit 38ef66d
Show file tree
Hide file tree
Showing 55 changed files with 273 additions and 553 deletions.
28 changes: 10 additions & 18 deletions tests/Cms/Api/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,12 @@ public function setUp(): void
'options' => [
'api' => [
'allowImpersonation' => true,
'authentication' => function () {
return true;
},
'routes' => [
'authentication' => fn () => true,
'routes' => [
[
'pattern' => 'foo',
'method' => 'GET',
'action' => function () {
return 'something';
}
'action' => fn () => 'something'
]
]
],
Expand Down Expand Up @@ -664,18 +660,14 @@ public function testSectionApi()
$app = $this->app->clone([
'sections' => [
'test' => [
'api' => function () {
return [
[
'pattern' => '/message',
'action' => function () {
return [
'message' => 'Test'
];
}
'api' => fn () => [
[
'pattern' => '/message',
'action' => fn () => [
'message' => 'Test'
]
];
}
]
]
]
],
'blueprints' => [
Expand Down
34 changes: 13 additions & 21 deletions tests/Cms/Api/routes/AccountRoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,16 @@ public function testFields()
],
'fields' => [
'test' => [
'api' => function () {
return [
[
'pattern' => '/',
'action' => function () {
return 'Test home route';
}
],
[
'pattern' => 'nested',
'action' => function () {
return 'Test nested route';
}
],
];
}
'api' => fn () => [
[
'pattern' => '/',
'action' => fn () => 'Test home route'
],
[
'pattern' => 'nested',
'action' => fn () => 'Test nested route'
],
]
]
]
]);
Expand Down Expand Up @@ -371,11 +365,9 @@ public function testSections()
],
'sections' => [
'test' => [
'toArray' => function () {
return [
'foo' => 'bar'
];
}
'toArray' => fn () => [
'foo' => 'bar'
]
]
]
]);
Expand Down
34 changes: 13 additions & 21 deletions tests/Cms/Api/routes/UsersRoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,16 @@ public function testFields()
],
'fields' => [
'test' => [
'api' => function () {
return [
[
'pattern' => '/',
'action' => function () {
return 'Test home route';
}
],
[
'pattern' => 'nested',
'action' => function () {
return 'Test nested route';
}
],
];
}
'api' => fn () => [
[
'pattern' => '/',
'action' => fn () => 'Test home route'
],
[
'pattern' => 'nested',
'action' => fn () => 'Test nested route'
],
]
]
]
]);
Expand Down Expand Up @@ -431,11 +425,9 @@ public function testSections()
],
'sections' => [
'test' => [
'toArray' => function () {
return [
'foo' => 'bar'
];
}
'toArray' => fn () => [
'foo' => 'bar'
]
]
]
]);
Expand Down
12 changes: 3 additions & 9 deletions tests/Cms/App/AppComponentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public function testCssPlugin()
{
$this->kirby->clone([
'components' => [
'css' => function ($kirby, $url, $options) {
return '/test.css';
}
'css' => fn ($kirby, $url, $options) => '/test.css'
]
]);

Expand All @@ -58,9 +56,7 @@ public function testJsPlugin()
{
$this->kirby->clone([
'components' => [
'js' => function ($kirby, $url, $options) {
return '/test.js';
}
'js' => fn ($kirby, $url, $options) => '/test.js'
]
]);

Expand Down Expand Up @@ -361,9 +357,7 @@ public function testUrlPlugin()
{
$this->kirby->clone([
'components' => [
'url' => function ($kirby, $path, $options) {
return 'test';
}
'url' => fn ($kirby, $path, $options) => 'test'
]
]);

Expand Down
Loading

0 comments on commit 38ef66d

Please sign in to comment.