-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add func test for ExtConf * Use DatabaseTrait in ExplainQueryHelper * Update lines mentioned by php-cs-fixer * Reduce func test to MySQL and MariaDB
- Loading branch information
Showing
4 changed files
with
169 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the package stefanfroemken/mysqlreport. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace StefanFroemken\Mysqlreport\Tests\Functional\Configuration; | ||
|
||
use PHPUnit\Framework\Attributes\Test; | ||
use StefanFroemken\Mysqlreport\Configuration\ExtConf; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
/** | ||
* Test case. | ||
*/ | ||
class ExtConfTest extends FunctionalTestCase | ||
{ | ||
private ExtConf $subject; | ||
|
||
protected array $testExtensionsToLoad = [ | ||
'stefanfroemken/mysqlreport', | ||
]; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->subject = $this->get(ExtConf::class); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
unset( | ||
$this->subject, | ||
); | ||
|
||
parent::tearDown(); | ||
} | ||
|
||
#[Test] | ||
public function isEnableFrontendLoggingInitiallyReturnsFalse(): void | ||
{ | ||
self::assertFalse( | ||
$this->subject->isEnableFrontendLogging(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function setEnableFrontendLoggingSetsEnableFrontendLogging(): void | ||
{ | ||
$this->subject->setEnableFrontendLogging('1'); | ||
|
||
self::assertTrue( | ||
$this->subject->isEnableFrontendLogging(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function isEnableBackendLoggingInitiallyReturnsFalse(): void | ||
{ | ||
self::assertFalse( | ||
$this->subject->isEnableBackendLogging(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function setEnableBackendLoggingSetsEnableBackendLogging(): void | ||
{ | ||
$this->subject->setEnableBackendLogging('1'); | ||
|
||
self::assertTrue( | ||
$this->subject->isEnableBackendLogging(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function isActivateExplainQueryInitiallyReturnsFalse(): void | ||
{ | ||
self::assertFalse( | ||
$this->subject->isActivateExplainQuery(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function setActivateExplainQuerySetsActivateExplainQuery(): void | ||
{ | ||
$this->subject->setActivateExplainQuery('1'); | ||
|
||
self::assertTrue( | ||
$this->subject->isActivateExplainQuery(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function getSlowQueryThresholdInitiallyReturns10Seconds(): void | ||
{ | ||
self::assertSame( | ||
10.0, | ||
$this->subject->getSlowQueryThreshold(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function setSlowQueryThresholdWithIntegerSetsSlowQueryThreshold(): void | ||
{ | ||
$this->subject->setSlowQueryThreshold('1'); | ||
|
||
self::assertSame( | ||
1.0, | ||
$this->subject->getSlowQueryThreshold(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function setSlowQueryThresholdWithFloatSetsSlowQueryThreshold(): void | ||
{ | ||
$this->subject->setSlowQueryThreshold('1.25'); | ||
|
||
self::assertSame( | ||
1.25, | ||
$this->subject->getSlowQueryThreshold(), | ||
); | ||
} | ||
|
||
#[Test] | ||
public function setSlowQueryThresholdWithCommaFloatSetsSlowQueryThreshold(): void | ||
{ | ||
$this->subject->setSlowQueryThreshold('5,38'); | ||
|
||
self::assertSame( | ||
5.38, | ||
$this->subject->getSlowQueryThreshold(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters