summaryrefslogtreecommitdiff
path: root/tests/Unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit')
-rw-r--r--tests/Unit/Controllers/PasswordResetControllerTest.php2
-rw-r--r--tests/Unit/Helpers/AuthenticatorTest.php4
-rw-r--r--tests/Unit/Helpers/Translation/TranslatorTest.php13
-rw-r--r--tests/Unit/Http/Psr7ServiceProviderTest.php2
-rw-r--r--tests/Unit/Logger/EngelsystemLoggerTest.php5
-rw-r--r--tests/Unit/Models/LogEntryTest.php20
-rw-r--r--tests/Unit/Models/User/UserTest.php2
7 files changed, 31 insertions, 17 deletions
diff --git a/tests/Unit/Controllers/PasswordResetControllerTest.php b/tests/Unit/Controllers/PasswordResetControllerTest.php
index 09538416..c83b06b9 100644
--- a/tests/Unit/Controllers/PasswordResetControllerTest.php
+++ b/tests/Unit/Controllers/PasswordResetControllerTest.php
@@ -152,7 +152,7 @@ class PasswordResetControllerTest extends TestCase
$response = $controller->postResetPassword($request);
$this->assertEquals(200, $response->getStatusCode());
- $this->assertEmpty((new PasswordReset)->find($user->id));
+ $this->assertEmpty((new PasswordReset())->find($user->id));
$this->assertNotNull(auth()->authenticate($user->name, $password));
}
diff --git a/tests/Unit/Helpers/AuthenticatorTest.php b/tests/Unit/Helpers/AuthenticatorTest.php
index 1dc39a28..03033858 100644
--- a/tests/Unit/Helpers/AuthenticatorTest.php
+++ b/tests/Unit/Helpers/AuthenticatorTest.php
@@ -259,7 +259,9 @@ class AuthenticatorTest extends ServiceProviderTest
return new class extends Authenticator
{
/** @noinspection PhpMissingParentConstructorInspection */
- public function __construct() { }
+ public function __construct()
+ {
+ }
};
}
}
diff --git a/tests/Unit/Helpers/Translation/TranslatorTest.php b/tests/Unit/Helpers/Translation/TranslatorTest.php
index afb1aabc..5e341cfd 100644
--- a/tests/Unit/Helpers/Translation/TranslatorTest.php
+++ b/tests/Unit/Helpers/Translation/TranslatorTest.php
@@ -32,7 +32,7 @@ class TranslatorTest extends ServiceProviderTest
->method('__invoke')
->withConsecutive(['te_ST'], ['fo_OO']);
- $translator = new Translator($locale, 'fo_OO', function () { }, $locales, $localeChange);
+ $translator = new Translator($locale, 'fo_OO', [$this, 'doNothing'], $locales, $localeChange);
$this->assertEquals($locales, $translator->getLocales());
$this->assertEquals($locale, $translator->getLocale());
@@ -55,7 +55,7 @@ class TranslatorTest extends ServiceProviderTest
{
/** @var Translator|MockObject $translator */
$translator = $this->getMockBuilder(Translator::class)
- ->setConstructorArgs(['de_DE', 'en_US', function () { }, ['de_DE' => 'Deutsch']])
+ ->setConstructorArgs(['de_DE', 'en_US', [$this, 'doNothing'], ['de_DE' => 'Deutsch']])
->onlyMethods(['translateText'])
->getMock();
$translator->expects($this->exactly(2))
@@ -77,7 +77,7 @@ class TranslatorTest extends ServiceProviderTest
{
/** @var Translator|MockObject $translator */
$translator = $this->getMockBuilder(Translator::class)
- ->setConstructorArgs(['de_DE', 'en_US', function () { }, ['de_DE' => 'Deutsch']])
+ ->setConstructorArgs(['de_DE', 'en_US', [$this, 'doNothing'], ['de_DE' => 'Deutsch']])
->onlyMethods(['translateText'])
->getMock();
$translator->expects($this->once())
@@ -131,4 +131,11 @@ class TranslatorTest extends ServiceProviderTest
// Successful translation
$this->assertEquals('Lorem test3!', $translator->translatePlural('foo.barf', 'foo.bar2', 3, ['test3']));
}
+
+ /**
+ * Does nothing
+ */
+ public function doNothing()
+ {
+ }
}
diff --git a/tests/Unit/Http/Psr7ServiceProviderTest.php b/tests/Unit/Http/Psr7ServiceProviderTest.php
index 25c2f6e3..d0df726b 100644
--- a/tests/Unit/Http/Psr7ServiceProviderTest.php
+++ b/tests/Unit/Http/Psr7ServiceProviderTest.php
@@ -20,7 +20,7 @@ class Psr7ServiceProviderTest extends ServiceProviderTest
*/
public function testRegister()
{
- $app = new Application;
+ $app = new Application();
$serviceProvider = new Psr7ServiceProvider($app);
$serviceProvider->register();
diff --git a/tests/Unit/Logger/EngelsystemLoggerTest.php b/tests/Unit/Logger/EngelsystemLoggerTest.php
index 3b67aa29..6343717c 100644
--- a/tests/Unit/Logger/EngelsystemLoggerTest.php
+++ b/tests/Unit/Logger/EngelsystemLoggerTest.php
@@ -69,7 +69,10 @@ class EngelsystemLoggerTest extends ServiceProviderTest
'user' =>
new class
{
- public function __toString() { return 'Bar'; }
+ public function __toString()
+ {
+ return 'Bar';
+ }
}
]);
}
diff --git a/tests/Unit/Models/LogEntryTest.php b/tests/Unit/Models/LogEntryTest.php
index 4b772cd0..d4cef2e0 100644
--- a/tests/Unit/Models/LogEntryTest.php
+++ b/tests/Unit/Models/LogEntryTest.php
@@ -16,15 +16,17 @@ class LogEntryTest extends TestCase
*/
public function testFilter()
{
- foreach ([
- 'I\'m an info' => LogLevel::INFO,
- '*Insert explosion here*' => LogLevel::EMERGENCY,
- 'Tracing along' => LogLevel::DEBUG,
- 'Oops' => LogLevel::ERROR,
- 'It\'s happening' => LogLevel::INFO,
- 'Something is wrong' => LogLevel::ERROR,
- 'Ohi' => LogLevel::INFO,
- ] as $message => $level) {
+ foreach (
+ [
+ 'I\'m an info' => LogLevel::INFO,
+ '*Insert explosion here*' => LogLevel::EMERGENCY,
+ 'Tracing along' => LogLevel::DEBUG,
+ 'Oops' => LogLevel::ERROR,
+ 'It\'s happening' => LogLevel::INFO,
+ 'Something is wrong' => LogLevel::ERROR,
+ 'Ohi' => LogLevel::INFO,
+ ] as $message => $level
+ ) {
(new LogEntry(['level' => $level, 'message' => $message]))->save();
}
diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php
index da121a4f..5cb8745d 100644
--- a/tests/Unit/Models/User/UserTest.php
+++ b/tests/Unit/Models/User/UserTest.php
@@ -113,7 +113,7 @@ class UserTest extends TestCase
foreach ($modelData as $data) {
/** @var BaseModel $model */
- $model = (new $class);
+ $model = $this->app->make($class);
$stored = $model->create($data + ['user_id' => $user->id]);
$relatedModelIds[] = $stored->id;
}