Skip to content

Commit 3de0a8c

Browse files
committed
removed -n flag, deprecated -C option
1 parent aaeb2e0 commit 3de0a8c

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- run: composer install --no-progress --prefer-dist
2525
- run: src/tester --info
2626
shell: bash
27-
- run: src/tester tests -s -C
27+
- run: src/tester tests -s
2828
shell: bash
2929
- if: failure()
3030
uses: actions/upload-artifact@v4
@@ -59,7 +59,7 @@ jobs:
5959
coverage: none
6060

6161
- run: composer install --no-progress --prefer-dist
62-
- run: src/tester -p phpdbg tests -s -C --coverage ./coverage.xml --coverage-src ./src
62+
- run: src/tester -p phpdbg tests -s --coverage ./coverage.xml --coverage-src ./src
6363
- run: wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
6464
- env:
6565
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CLAUDE.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Nette Tester is a lightweight, standalone PHP testing framework designed for sim
1616

1717
```bash
1818
# or directly:
19-
src/tester tests -s -C
19+
src/tester tests -s
2020

2121
# Run specific test file
22-
src/tester tests/Framework/Assert.phpt -s -C
22+
src/tester tests/Framework/Assert.phpt -s
2323

2424
# or simply
2525
php tests/Framework/Assert.phpt
@@ -32,7 +32,6 @@ vendor/bin/phpstan analyse
3232

3333
**Common test runner options:**
3434
- `-s` - Show information about skipped tests
35-
- `-C` - Use system-wide php.ini
3635
- `-c <path>` - Use specific php.ini file
3736
- `-d key=value` - Set PHP INI directive
3837
- `-j <num>` - Number of parallel jobs (default: 8, use 1 for serial)
@@ -806,10 +805,7 @@ Assert::fail('Error in connection');
806805

807806
### PHP INI Handling
808807

809-
Tester runs PHP processes with `-n` flag (no php.ini loaded):
810-
- Ensures consistent test environment
811-
- System extensions from `/etc/php/conf.d/*.ini` are NOT loaded
812-
- Use `-C` flag to load system php.ini
808+
Tester runs PHP processes with the system php.ini:
813809
- Use `-c path/to/php.ini` for custom php.ini
814810
- Use `-d key=value` for individual INI settings
815811

readme.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Now we run tests from command-line using the `tester` command:
8585
|_ _/ __)( __/_ _/ __)| _ )
8686
|_| \___ /___) |_| \___ |_|_\ v2.6
8787
88-
PHP 8.2.0 | php -n | 8 threads
88+
PHP 8.2.0 | php | 8 threads
8989
.
9090
OK (1 tests, 0 skipped, 0.0 seconds)
9191
```
@@ -218,7 +218,6 @@ Usage:
218218
Options:
219219
-p <path> Specify PHP interpreter to run (default: php).
220220
-c <path> Look for php.ini file (or look in directory) <path>.
221-
-C Use system-wide php.ini.
222221
-l | --log <path> Write log to file <path>.
223222
-d <key=value>... Define INI entry 'key' with value 'val'.
224223
-s Show information about skipped tests.

src/Runner/CliTester.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ private function loadOptions(): CommandLine
109109
Options:
110110
-p <path> Specify PHP interpreter to run (default: php).
111111
-c <path> Look for php.ini file (or look in directory) <path>.
112-
-C Use system-wide php.ini.
113112
-d <key=value>... Define INI entry 'key' with value 'value'.
114113
-s Show information about skipped tests.
115114
--stop-on-fail Stop execution upon the first failure.
@@ -128,6 +127,7 @@ private function loadOptions(): CommandLine
128127
XX,
129128
[
130129
'-c' => [CommandLine::RealPath => true],
130+
'-C' => [], // deprecated
131131
'--watch' => [CommandLine::Repeatable => true, CommandLine::RealPath => true],
132132
'--setup' => [CommandLine::RealPath => true],
133133
'--temp' => [],
@@ -189,11 +189,9 @@ private function loadOptions(): CommandLine
189189

190190
private function createPhpInterpreter(): void
191191
{
192-
$args = $this->options['-C'] ? [] : ['-n'];
192+
$args = [];
193193
if ($this->options['-c']) {
194194
array_push($args, '-c', $this->options['-c']);
195-
} elseif (!$this->options['--info'] && !$this->options['-C']) {
196-
echo "Note: No php.ini is used.\n";
197195
}
198196

199197
if (in_array($this->stdoutFormat, ['tap', 'junit'], strict: true)) {

tests/Runner/PhpInterpreter.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,10 @@ if (extension_loaded('pcov')) {
3333
}
3434

3535
Assert::count($count, $engines);
36+
37+
38+
// createInterpreter() uses same php.ini as parent
39+
if (!$interpreter->isCgi()) {
40+
$output = shell_exec($interpreter->withArguments('-r', 'echo php_ini_loaded_file();')->getCommandLine());
41+
Assert::same(php_ini_loaded_file(), $output);
42+
}

tests/bootstrap.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414

1515
function createInterpreter(): PhpInterpreter
1616
{
17-
$args = strlen((string) php_ini_scanned_files())
18-
? []
19-
: ['-n'];
20-
21-
if (php_ini_loaded_file()) {
22-
array_push($args, '-c', php_ini_loaded_file());
17+
$args = [];
18+
if ($file = php_ini_loaded_file()) {
19+
array_push($args, '-c', $file);
2320
}
2421

2522
return new PhpInterpreter(PHP_BINARY, $args);

0 commit comments

Comments
 (0)