Skip to content

Commit bc8ffe6

Browse files
committed
Updating docs
1 parent ab83ff6 commit bc8ffe6

File tree

2 files changed

+31
-41
lines changed

2 files changed

+31
-41
lines changed

README.md

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -832,75 +832,63 @@ I am testing mainly on Ubuntu and I have the following test setups:
832832

833833
This should cover most environments, but please notify me of failing tests and report your environment.
834834

835-
### MySQL on Linux
835+
### MySQL, PostgreSQL, and SQLite on Linux
836836

837-
There are PHPUnit tests in the file 'tests.php'. You need to configure your test database connection in this file. After that run:
837+
The tests are held in the `tests.php` file, but first you should copy the `config.php.dist` file to `config.php` and add your database credentials. You can add credentials for one or all the databases supported.
838+
839+
After configuring the database connections, use PHPUnit to run all the tests:
838840

839841
```
840842
$ wget https://phar.phpunit.de/phpunit.phar
841-
$ php phpunit.phar tests/tests.php
842-
PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
843+
$ php phpunit.phar
844+
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
843845
844-
.................................................. 50 / 50 (100%)
846+
............................................................... 63 / 304 ( 20%)
847+
............................................................... 126 / 304 ( 41%)
848+
..........................SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS 189 / 304 ( 62%)
849+
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS........................ 252 / 304 ( 82%)
850+
.................................................... 304 / 304 (100%)
845851
846-
Time: 495 ms, Memory: 10.00Mb
852+
Time: 11.16 seconds, Memory: 12.00MB
847853
848-
OK (50 tests, 75 assertions)
854+
OK, but incomplete, skipped, or risky tests!
855+
Tests: 6004, Assertions: 338, Skipped: 76.
849856
$
850857
```
851858

852-
NB: You MUST use an empty database as a desctructive database fixture ('blog_mysql.sql') is loaded.
853-
854-
### SQL server on Windows:
855-
856-
```
857-
C:\php-crud-api>"C:\PHP\php.exe" phpunit.phar tests\tests.php
858-
PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
859-
860-
.................................................. 50 / 50 (100%)
861-
862-
Time: 1.47 seconds, Memory: 6.75Mb
863-
864-
OK (50 tests, 73 assertions)
859+
You can also run tests for only one database at a time if you'd like. For example to run MySQL tests, specify the `MysqlTest.php` file:
865860

866-
C:\php-crud-api>
867861
```
862+
$ php phpunit.phar tests/MysqlTest.php
863+
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
868864
869-
NB: You MUST use an empty database as a desctructive database fixture ('blog_sqlserver.sql') is loaded.
865+
................................................................. 65 / 76 ( 85%)
866+
........... 76 / 76 (100%)
870867
871-
### PostgreSQL on Linux
868+
Time: 3.54 seconds, Memory: 10.00MB
872869
873-
```
874-
$ wget https://phar.phpunit.de/phpunit.phar
875-
$ php phpunit.phar tests/tests.php
876-
PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
877-
878-
.................................................. 50 / 50 (100%)
879-
880-
Time: 1.09 seconds, Memory: 8.00Mb
881-
882-
OK (50 tests, 75 assertions)
870+
OK (76 tests, 113 assertions)
883871
$
884872
```
885873

886-
NB: You MUST use an empty database as a desctructive database fixture ('blog_postgresql.sql') is loaded.
874+
NB: You MUST use an empty database as a destructive database fixture is loaded.
887875

888-
### SQLite on Linux
876+
### SQL server on Windows:
889877

890878
```
891-
$ wget https://phar.phpunit.de/phpunit.phar
892-
$ php phpunit.phar tests/tests.php
879+
C:\php-crud-api>"C:\PHP\php.exe" phpunit.phar
893880
PHPUnit 5.3.2 by Sebastian Bergmann and contributors.
894881
895882
.................................................. 50 / 50 (100%)
896883
897-
Time: 1.96 seconds, Memory: 8.00Mb
884+
Time: 1.47 seconds, Memory: 6.75Mb
898885
899-
OK (50 tests, 74 assertions)
900-
$
886+
OK (50 tests, 73 assertions)
887+
888+
C:\php-crud-api>
901889
```
902890

903-
NB: You MUST use an empty database as a desctructive database fixture ('blog_sqlite.sql') is loaded.
891+
NB: You MUST use an empty database as a desctructive database fixture ('blog_sqlserver.sql') is loaded.
904892

905893
## Installing MySQL on Ubuntu Linux
906894

tests/config.php.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class PHP_CRUD_API_Config
1616
'password' => '{{test_password}}', // May be empty on SQLServer or SQLite
1717
'database' => '{{test_database}}', // NB: Use an empty database, data will be LOST!
1818
],
19+
/* Uncomment and update for any databases you want to use.
1920
[
2021
'dbengine' => 'PostgreSQL',
2122
'hostname' => '',
@@ -37,5 +38,6 @@ class PHP_CRUD_API_Config
3738
'password' => '',
3839
'database' => '',
3940
],
41+
*/
4042
];
4143
}

0 commit comments

Comments
 (0)