Skip to content

Commit ec39e81

Browse files
committed
Agregar tests unitarios e integración para MySQLDriver y configuración inicial de PHPUnit
- Incluidos tests unitarios para validar comportamiento y funcionalidad del driver MySQL: generación de DSN, opciones de PDO, validación de parámetros, inicialización, y operaciones comunes. - Agregadas pruebas de integración que incluyen creación de conexiones, manejo de tablas, transacciones, análisis y optimización. - Configuración inicial de PHPUnit mediante `phpunit.xml`, integración en `composer.json`, y actualización de `.gitignore` para manejar archivos relacionados a pruebas. - Añadidas dependencias de desarrollo: PHPUnit y Mockery.
1 parent d174848 commit ec39e81

File tree

6 files changed

+1322
-1
lines changed

6 files changed

+1322
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ composer.lock
99
out
1010
gen
1111

12+
# Testing
13+
coverage/
14+
.phpunit.result.cache
15+
1216
# others
1317
utils.md

composer.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mongoose-studio/phobos-framework-database-mysql",
3-
"description": "Phobos PHP Framework Mysql Connector for Database Layer",
3+
"description": "Phobos Framework Mysql Connector for Database Layer",
44
"version": "3.0.1",
55
"type": "library",
66
"license": "MIT",
@@ -10,6 +10,10 @@
1010
"mongoose-studio/phobos-framework": "^3.0",
1111
"mongoose-studio/phobos-framework-database": "^3.0"
1212
},
13+
"require-dev": {
14+
"phpunit/phpunit": "^10.5",
15+
"mockery/mockery": "^1.6"
16+
},
1317
"authors": [
1418
{
1519
"name": "Marcel Rojas",
@@ -20,5 +24,16 @@
2024
"psr-4": {
2125
"PhobosFramework\\Database\\": "src/"
2226
}
27+
},
28+
"autoload-dev": {
29+
"psr-4": {
30+
"PhobosFramework\\Database\\Tests\\": "tests/"
31+
}
32+
},
33+
"scripts": {
34+
"test": "phpunit",
35+
"test-unit": "phpunit --testsuite=Unit",
36+
"test-integration": "phpunit --testsuite=Integration",
37+
"test-coverage": "export XDEBUG_MODE=coverage && phpunit --coverage-html coverage"
2338
}
2439
}

phpunit.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
executionOrder="depends,defects"
7+
requireCoverageMetadata="false"
8+
beStrictAboutCoverageMetadata="true"
9+
beStrictAboutOutputDuringTests="true"
10+
failOnRisky="true"
11+
failOnWarning="true">
12+
<testsuites>
13+
<testsuite name="Unit">
14+
<directory>tests/Unit</directory>
15+
</testsuite>
16+
<testsuite name="Integration">
17+
<directory>tests/Integration</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<source>
22+
<include>
23+
<directory>src</directory>
24+
</include>
25+
</source>
26+
27+
<php>
28+
<env name="DB_HOST" value="localhost"/>
29+
<env name="DB_PORT" value="3306"/>
30+
<env name="DB_DATABASE" value="test"/>
31+
<env name="DB_USERNAME" value="root"/>
32+
<env name="DB_PASSWORD" value=""/>
33+
</php>
34+
</phpunit>

0 commit comments

Comments
 (0)