Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test to function php_ini_scanned_files(); #1811

Closed
wants to merge 9 commits into from

Conversation

marcosptf
Copy link
Contributor

was added new function to php_ini_scanned_files();

@divinity76
Copy link
Contributor

i think its safer to use if(version_compare(PHP_VERSION, '5.3.0', '<'))
and SKIP php version so lower. sounds wrong.. maybe SKIP php version too low

@marcosptf
Copy link
Contributor Author

Hi @divinity76 , how are you?
thanks for your comment, i've fixed the skip message like you suggest.
have a nice day!
:-)

marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
--SKIPIF--
<?php
if (phpversion() < "5.3.0") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO there's no need to check for PHP versions < 5.3.0, because the test is supposed to be included in PHP 7.1 upward only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okey, its true!
ill fix it asap!

@marcosptf
Copy link
Contributor Author

@divinity76 @cmb69
I've fixed like you suggest !
Thanks

@KalleZ
Copy link
Member

KalleZ commented Oct 26, 2016

Test seems fine to me @marcosptf

@cmb69
Copy link
Member

cmb69 commented Oct 26, 2016

@KalleZ The test only verifies that php_ini_scanned_files() returns a string, but not that the content of the string makes any sense. In my opinion, a rather weak test.

@marcosptf
Copy link
Contributor Author

@KalleZ @cmb69 in my opinion is impossible check each file that this function return because it can change in a server or environment different's.

because this, i just see what type this function return and don't the values, like the docs said:
http://php.net/manual/en/function.php-ini-scanned-files.php

@KalleZ
Copy link
Member

KalleZ commented Oct 26, 2016

@cmb69 I do agree, but like @marcosptf said then it can maybe be a little more trickier to get a consistent output, especially if you run with a system ini (I don't think run-tests.php passes -n to php by default, no?) which means that you would have to do something like:

foreach(explode(',', php_ini_scanned_files()) as $ini) {
        $ini = trim($ini);

        // ... $ini ...
}

And still get variable results, so despite it being "weak", I do think its fair enough to put in for coverage

@cmb69
Copy link
Member

cmb69 commented Oct 27, 2016

AFAIK run-tests.php sets up a controlled environment (using a temporary ini file) before actually running the test. And there is the --ARGS-- section which could be used. I'll have a closer look at this later today, if nobody beats me to it.

@KalleZ
Copy link
Member

KalleZ commented Oct 27, 2016

@cmb69 ah brilliant, I totally forgot about the --ARGS-- section :)

@cmb69
Copy link
Member

cmb69 commented Oct 27, 2016

Just had a closer look at it. Actually, we would need to set the PHP_INI_SCAN_DIR environment variable to test php_ini_scanned_files. According to the docs we could set it to $filepath, but the documentation is completely wrong. The --ENV-- section actually contains lines in an ini style, and no replacement is done. :-(

So I suggest to

  • merge this PR
  • fix the docs on qa.php.net
  • consider to improve our test runners

@cmb69
Copy link
Member

cmb69 commented Oct 27, 2016

Ah, it appears that the docs is correct for server-tests.php. Shouldn't both server-tests.php and run-tests.php understand the same format? :-/

@KalleZ
Copy link
Member

KalleZ commented Oct 27, 2016

I don't think server tests is even operational?

On Oct 27, 2016 16:12, "Christoph M. Becker" notifications@github.com
wrote:

Ah, it appears that the docs is correct for server-tests.php
https://github.com/php/php-src/blob/PHP-7.0.13/server-tests.php#L1106-L1117.
Shouldn't both server-tests.php and run-tests.php understand the same
format? :-/


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1811 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAI-aj7GxmdfgH-IJJGPGqjj3X2wV5E5ks5q4LFJgaJpZM4HveTy
.

@krakjoe
Copy link
Member

krakjoe commented Jan 3, 2017

As has already been pointed out, this is a weak test: We could change the behaviour of this function considerably and so long as it returns a string, the test would pass. That's not useful.

Since this doesn't add any value whatsoever, I'm closing this PR.

If you feel I am wrong to do that, please open a clean PR with a sensible test, one that actually does add value to our testing suite.

Superficial coverage is not useful for us, and only serves to slow our CI down.

@krakjoe krakjoe closed this Jan 3, 2017
php-pulls pushed a commit that referenced this pull request Oct 30, 2017
Not regarding the CGI section might even been seen as a bug, and since
server-tests.php appears to broken, anway[1][2], we implement it for
run-tests.php in the way as described[3] for server-tests.php, i.e.
respective tests are skipped if no CGI executable is found.

[1] <#222 (comment)>
[2] <#1811 (comment)>
[3] <https://qa.php.net/phpt_details.php#cgi_section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants