Tester: print tests environment

Notice: This thread is very old.
Milo
Nette Core | 1283
+
0
-

Reason

Using a Nette Tester is easy (at least for me). But for a familiarization it can seem to be tricky, mainly part with default -n or -n -c php.ini options. It would be helpful to show how the environment really looks from running tests point of view.

Propose

Add new option -i Print environment info. If runned with this option, Tester prints and exits:

Nette Tester (v0.0.0)
---------------------
PHP version:
	5.5.4 (CGI)

PHP binary:
	/home/milo/php/5.5.4/php-cgi

INI files:
	/home/milo/tester/php.ini
	/etc/php/conf.d/*

Extensions:
	core
	dom
	pdo
	pdo_pgsql
	...

Implementation

Add new file Tester/Runner/dump-environment.php which will contain something like:

echo json_encode(array(
	'version' => PHP_VERSION,
	'binary' => defined('PHP_BINARY') ? PHP_BINARY : NULL,
	'extensions' => get_loaded_extensions(),
	...
));

This file will be runned as a Runner\Job when tester -i invoked.

To be discussed

Propose seems to me pretty straightforward, but there is a few things I would like to discuss:

  • which next important info sould be printed
  • output text sould be short, well, there can be a lot of extensions
  • maybe better option name, seems to me waste of short option -i for this, on the other hand it is handy and fast to write

Last edited by Milo (2014-02-11 11:36)

David Grudl
Nette Core | 8218
+
0
-

Looks great!

Maybe -i (like info) is better than -e. And it be implemented without dump-environment.php, via php -r.

What about write extensions separated by comma?

Milo
Nette Core | 1283
+
0
-

David Grudl wrote:

Maybe -i (like info) is better than -e.

Agree, it's better. RFC updated.

And it be implemented without dump-environment.php, via php -r.

Unfortunately -r works with CLI only.

What about write extensions separated by comma?

Sounds good.

Last edited by Milo (2014-01-21 21:23)

nAS
Member | 277
+
0
-

I like it, especially printing parsed .ini files can be very useful. Few month ago I spent some time by debugging our test environment because wrong .ini files were used.

David Grudl
Nette Core | 8218
+
0
-

@nAS Used ini file is displayed by default:

Nette Tester (v0.9.5)
---------------------
Log: W:\Nette\_nette\tests\test.log
PHP 5.3.6 | "C:\PHP\versions\php-5.3.6\php-cgi.exe" -n -c "W:\Nette\_nette\tests\php-win.ini" | 50 threads
hrach
Member | 1838
+
0
-

+1

Filip Procházka
Moderator | 4668
+
0
-

+1

Patrik Votoček
Member | 2221
+
0
-

+1

Pavel Macháň
Member | 282
+
0
-

+1

tomas.lang
Member | 53
+
0
-

+1

David Grudl
Nette Core | 8218
+
0
-

Myslím, že shoda je jednomyslná, takže bude fajn, když to implementuješ.

Milo
Nette Core | 1283
+
0
-

Thanks to all. I'll send PR soon.

EDIT: RFC implemented

Last edited by Milo (2014-02-11 11:39)