-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add argument for opcache only
- Loading branch information
Showing
2 changed files
with
77 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of CodeIgniter 4 framework. | ||
* | ||
* (c) CodeIgniter Foundation <[email protected]> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CodeIgniter\Commands\Utilities; | ||
|
||
use CodeIgniter\Test\CIUnitTestCase; | ||
use CodeIgniter\Test\StreamFilterTrait; | ||
use Config\App; | ||
use PHPUnit\Framework\Attributes\Group; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
#[Group('Others')] | ||
final class PhpIniCheckTest extends CIUnitTestCase | ||
{ | ||
use StreamFilterTrait; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->resetServices(); | ||
parent::setUp(); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
$this->resetServices(); | ||
parent::tearDown(); | ||
} | ||
|
||
protected function getBuffer() | ||
{ | ||
return $this->getStreamFilterBuffer(); | ||
} | ||
|
||
public function testCommandCheckNoArg(): void | ||
{ | ||
command('phpini:check'); | ||
|
||
$result = $this->getBuffer(); | ||
|
||
$this->assertStringContainsString('Directive', $result); | ||
$this->assertStringContainsString('Global', $result); | ||
$this->assertStringContainsString('Current', $result); | ||
$this->assertStringContainsString('Recommended', $result); | ||
$this->assertStringContainsString('Remark', $result); | ||
} | ||
|
||
public function testCommandCheckOpcache(): void | ||
{ | ||
command('phpini:check opcache'); | ||
|
||
$this->assertStringContainsString("opcache.save_comments", $this->getBuffer()); | ||
} | ||
|
||
public function testCommandCheckNoExistsArg(): void | ||
{ | ||
command('phpini:check noexists'); | ||
|
||
$this->assertStringContainsString( | ||
'You must write correct arguments.', | ||
$this->getBuffer() | ||
); | ||
} | ||
} |
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