Skip to content

Commit

Permalink
improve test documentation
Browse files Browse the repository at this point in the history
Explain how pdo/*.inc test files are used by driver specific tests.
  • Loading branch information
lavarou committed Dec 31, 2024
1 parent 9bb85e4 commit bb4d7fb
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/integration/pdo/test_instance_reporting.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that executes SQL statements using a given connection object.
It is used to test database instance reporting functionality which results in database
instance metrics being created as well as database instance attributes being added to
slow sql traces as well as span events.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

function test_instance_reporting($conn, $want_drop_table_result=1) {
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/pdo/test_prepared_stmt_1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that runs the PDOStatement::execute() test on PDOStatement
object prepared using a given connection object.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
It tests PDOStatement without any values bound.
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

function test_prepared_stmt($conn, $query) {
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/pdo/test_prepared_stmt_2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that runs the PDOStatement::execute() test on PDOStatement
object prepared using a given connection object.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
It tests PDOStatement with values bound.
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

function test_prepared_stmt($conn, $query) {
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/pdo/test_query_1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that runs the PDO::query test using given connection object.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
It tests one argument form of PDO::query().
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

function test_pdo_query($conn, $want_drop_table_result=1) {
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/pdo/test_query_2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that runs the PDO::query test using given connection object.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
It tests the FETCH_COLUMN variant of PDO::query().
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

function test_pdo_query($conn, $want_drop_table_result=1) {
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/pdo/test_query_3.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that runs the PDO::query test using given connection object.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
It tests the FETCH_CLASS variant of PDO::query().
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

class Row {
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/pdo/test_query_4.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*
This file contains code that runs the PDO::query test using given connection object.
It is common for all database driver specific tests that prepare connection objects
using different methods:
- ./mysql:
- ./base-class
- ./constructor
- ./factory
- ./pgsql:
- ./base-class
- ./constructor
- ./factory
- ./sqlite:
- ./base-class
- ./constructor
- ./factory
It tests the FETCH_INTO variant of PDO::query().
*/

require_once(dirname(__FILE__).'/../../include/tap.php');

class Row {
Expand Down

0 comments on commit bb4d7fb

Please sign in to comment.