Skip to content

Commit

Permalink
OXDEV-8207: Fix phpunit errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid committed May 27, 2024
1 parent d6cc532 commit 4c6c81a
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 132 deletions.
40 changes: 20 additions & 20 deletions tests/Integration/Controller/GreetingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,26 @@ public function providerOemtGreeting(): array
{
return [
'without_user_generic' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expected' => '',
'count' => 0,
],
'without_user_personal' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expected' => '',
'count' => 0,
],
'with_user_generic' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expect' => self::TEST_GREETING,
'count' => 0,
],
'with_user_personal' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expect' => self::TEST_GREETING_UPDATED,
'count' => 1,
],
Expand All @@ -117,33 +117,33 @@ public function providerRender(): array
{
return [
'without_user_generic' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expected' => [
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expected' => [
'greeting' => '',
'counter' => 0,
],
],
'without_user_personal' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expected' => [
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expected' => [
'greeting' => '',
'counter' => 0,
],
],
'with_user_generic' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expected' => [
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expected' => [
'greeting' => '',
'counter' => 0,
],
],
'with_user_personal' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expected' => [
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expected' => [
'greeting' => self::TEST_GREETING,
'counter' => 67,
],
Expand Down
52 changes: 26 additions & 26 deletions tests/Integration/Controller/StartControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class StartControllerTest extends IntegrationTestCase
/**
* @dataProvider providerCanUpdateOemtGreeting
*/
public function testCanUpdateOemtGreeting(bool $hasUser, string $mode, string $expect): void
public function testCanUpdateOemtGreeting(bool $hasUser, string $mode, string $assert): void
{
$moduleSettings = $this->getServiceFromContainer(ModuleSettings::class);
$moduleSettings->saveGreetingMode($mode);
Expand All @@ -44,7 +44,7 @@ public function testCanUpdateOemtGreeting(bool $hasUser, string $mode, string $e
$controller->setUser($this->getTestUser());
}

$this->$expect($controller->canUpdateOemtGreeting());
$this->$assert($controller->canUpdateOemtGreeting());
}

/**
Expand Down Expand Up @@ -73,24 +73,24 @@ public function providerCanUpdateOemtGreeting(): array
{
return [
'without_user_generic' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'assert' => 'assertFalse',
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'assert' => 'assertFalse',
],
'without_user_personal' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'assert' => 'assertFalse',
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'assert' => 'assertFalse',
],
'with_user_generic' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'assert' => 'assertFalse',
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'assert' => 'assertFalse',
],
'with_user_personal' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'assert' => 'assertTrue',
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'assert' => 'assertTrue',
],
];
}
Expand All @@ -99,24 +99,24 @@ public function providerGetOemtGreeting(): array
{
return [
'without_user_generic' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expect' => 'OEMODULETEMPLATE_GREETING_GENERIC',
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expect' => 'OEMODULETEMPLATE_GREETING_GENERIC',
],
'without_user_personal' => [
'user' => false,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expect' => '',
'hasUser' => false,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expect' => '',
],
'with_user_generic' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expect' => 'OEMODULETEMPLATE_GREETING_GENERIC',
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_GENERIC,
'expect' => 'OEMODULETEMPLATE_GREETING_GENERIC',
],
'with_user_personal' => [
'user' => true,
'greeting_mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expect' => self::TEST_GREETING,
'hasUser' => true,
'mode' => ModuleSettings::GREETING_MODE_PERSONAL,
'expect' => self::TEST_GREETING,
],
];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Service/GreetingMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testGenericGreetingNoUser(string $mode, string $expected): void
$this->assertSame($expected, $service->getGreeting());
}

public function getGreetingDataProvider(): array
public static function getGreetingDataProvider(): array
{
return [
[
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Service/ModuleSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetGreetingMode(string $value, string $expected): void
$this->assertSame($expected, $sut->getGreetingMode());
}

public function getGreetingModeDataProvider(): array
public static function getGreetingModeDataProvider(): array
{
return [
[
Expand Down Expand Up @@ -67,7 +67,7 @@ public function testIsPersonalGreetingMode(string $value, bool $expected): void
$this->assertSame($expected, $sut->isPersonalGreetingMode());
}

public function isPersonalGreetingModeDataProvider(): array
public static function isPersonalGreetingModeDataProvider(): array
{
return [
[
Expand Down
60 changes: 0 additions & 60 deletions tests/github_actions/module-template.yml

This file was deleted.

41 changes: 18 additions & 23 deletions tests/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="false"
beStrictAboutTodoAnnotatedTests="false"
convertDeprecationsToExceptions="true"
beStrictAboutTestsThatDoNotTestAnything="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
backupGlobals="true"
backupStaticAttributes="false"
colors="true"
testdox="false"
verbose="false">
<coverage includeUncoveredFiles="true"
processUncoveredFiles="false"
cacheDirectory=".phpunit.cache/code-coverage">
<include>
<directory suffix=".php">../src</directory>
</include>
</coverage>
backupStaticProperties="false"
colors="true">
beStrictAboutTestsThatDoNotTestAnything="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="false"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
<testsuites>
<testsuite name="Unit">
<directory>Unit/</directory>
Expand All @@ -37,4 +24,12 @@
<directory>Integration/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">../src</directory>
</include>
<exclude>
<directory suffix=".php">../tests</directory>
</exclude>
</source>
</phpunit>

0 comments on commit 4c6c81a

Please sign in to comment.