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
testconf.php.dist for more flexible local cross db tests #441
base: master
Are you sure you want to change the base?
Conversation
tests/test-*.php files can include an existing testconf.php or default testconf.php.dist for looping their tests through a list of configured database connections. As there are many database types supported by ADOdb and nobody has all databases and versions available on local test environments, this allows at least configuring individual subsets to be tested. Well, the tests/test-* must be adapted too.
example usage (for instance by tests/test-xmlschema.php):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, no impact on production systems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just a config file that is currently not referenced anywhere, so while it's true that it has no produciton impact, the PR does not add any value as it stands.
I am fine with the concept of having a test config and a .dist one to configure the tests, but if the actual tests do not make use of it, there is no point in merging this.
In addition, the code should follow coding guidelines (PSR2) and the $testdbs array elements should have meaningful, descriptive names (i.e. user, password, hostname, etc. instead of paramN).
So how to break the hen-egg problem? :-) The tests/* and examples on adodb.org are scattered with db setups that probably only Lohn Lim used on his system (I do not know) and aren't testable for everyone. I made them so each paramX align a bit vertically to see also differences between database connection parameters between database types. Also the naming of the params follows |
@dregad What of 'not following PSR2' is bugging you here? The tests/* stuff is nearly unusable for anybody in current state and not included in releases nor master snapshots. usage of such conf file could be used by testdatabases.inc.php etc when doing also required cleanup there. |
@peterdd The more important remarks in my earlier review were
Please note that I'm not challenging the fact that John Lim's legacy scripts are pretty much useless today, and I am definitely not opposed to implementing proper tests or your approach of defining a set of configs. All I'm saying is that it does not make sense to merge this, until there are test scripts actually making use of it. Now since you seem to be more interested in the details, here it goes:
PSR-2 has been deprecated, so nowadays the reference should be PSR-12 (or even PER Coding Style 2.0, but to my knowledge that is not yet covered by PHP_CodeSniffer rules). As to what I meant in terms of config guidelines:
And of course the same changes should be applied to commented-out sample lines as well. Long lines should be split. In this case I would recommend to declare the testdbs array entries with one key per line.
Send a pull request that also provides at least one test case / script that makes use of your config file. |
Thx @dregad Ok, I try. |
Have you an idea how to name tests? I thought something like
I sometimes see in other projects something like 001.php,002.php ..., but having a bit context at the test filename would be cool IMHO. |
tests/test-*.php files can include an existing testconf.php or default testconf.php.dist for looping their tests through a list of configured database connections. As there are many database types supported by ADOdb and nobody has all databases and versions available on local test environments, this allows at least configuring individual subsets to be tested.
Well, the tests/test-* must be adapted too.