-
Notifications
You must be signed in to change notification settings - Fork 267
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
Travis CI Integration #319
base: master
Are you sure you want to change the base?
Conversation
Add Travis-CI integration and PHPUnit tests. This includes MySQL (mysqli), Postgres (postgres9), and SQLite (sqlite3) plus the PDO variants of each. Tests can also be run locally by creating a `tests/credentials.json` file formatted: ```json { "postgres": { "user": "username", "password": "password" }, "mysql": { "user": "username", "password": "password" } } ``` Tests that have been ported from existing scripts are `test-active-record.php`, `test-datadict.php`, and `test-xmlschema.php`. I also added a number of new tests calling various methods of `ADOConnection`.
So you want write the same tests for each database again? So each such test file must be maintained and synced? I would prefer a solution without redundancy. I wish someone could pickup my rough idea #161 , review, and fill it with real tests. |
Not the exact same tests. The actual capabilities of the different databases (as well as the PDO / non-PDO variants) are different enough that it seems like the better option. To have a single set of tests running on all of them, the test set would have to be really limited in what it covers or be riddled with conditionals for tests that have different inputs and/or outputs with a given driver or tests that should simply be skipped for a given driver. I think the repetitiveness is worthwhile to have logically straightforward test methods that simply call a serious of functions in order. Less complicated test methods are less likely to contain logic bugs and thus less likely to require maintenance anyway. Ideally the test should only need updates if the behavior of tested functionality is intentionally changed. |
The purpose of ADOdb:
Having single sourced test cases for the ADOdb / SQL core features most databases provide is important I think. For databases who have extended capabilities beyond SQL standards and where ADOdb supports it, extra test cases can be written additional, no problem. For databases that only support a subset of SQL or the ADOdb hasn't implemented yet, that tests can be skipped. For example if a database driver doesn't support foreign keys, that tests will get skipped. An example would be MySQL MyISAM engine would skip the foreign key test cases. |
I don't disagree in principle and have no objection to having a subset of tests that are expected to run on all databases with identical code. I just think those are going to wind up being the minority. Let's compare Next I might want to insert a record. Calling Some of these things, arguably, are bugs that could be fixed. ADOdb could do a better job hiding some of these differences. But I'm aiming to keep this PR strictly tests without changing any existing functionality. |
Adds AllTest to contain tests that will run on all available drivers.
b7f5de6 adds a place to put test code that can run correctly against all six drivers. |
I recognize that there has been some delay in responding to this, and I don't know if you are still interested in this project, but I have just cloned your code to have at look at it. I have a couple of thoughts regarding the code so far:
|
I'll look at rearranging code and adding comments but wanted to respond to this part:
In a nutshell, automation. On a pull request and/or commit to With ADOdb specifically I don't think it makes sense to mock out the database. Such a database-centric library should get tested against real databases and Travis-CI provides a way to test against multiple databases without making the developer install & configure them all locally. |
* Move additions to a separate "travis" directory * Add some comments
I noticed #152 in the issues list. This seems like a good one to check off before getting too deep into a refactor like #317. It's also strictly new files so it shouldn't conflict with the current PHPDoc effort. I did notice PR #161 on the same subject but that doesn't seem to have any tests beyond just opening a connection to a database.
Adds Travis-CI integration and PHPUnit tests.
This includes MySQL (mysqli), Postgres (postgres9), and SQLite (sqlite3) plus the PDO variants of each. Tests can also be run locally by creating a
tests/credentials.json
file formatted:Tests that have been ported from existing scripts are
test-active-record.php
,test-datadict.php
, andtest-xmlschema.php
. I also added a number of new tests calling various methods ofADOConnection
.