Skip to content

Commit f8eb4af

Browse files
committed
feat: Atualiza .gitignore para incluir diretório de cobertura e ajusta composer.json para versão específica do pivotphp/core; modifica phpunit.xml para desativar falhas em depreciações e altera MetricsCollector para logar falhas de consulta apenas fora do ambiente de teste
1 parent 3a9b90f commit f8eb4af

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# Testing
1111
.phpunit.cache/
12+
coverage/
1213
coverage-html/
1314
coverage.xml
1415
junit.xml

composer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
22
"name": "pivotphp/cycle-orm",
33
"description": "Robust and well-tested Cycle ORM integration for PivotPHP microframework with type safety and comprehensive testing",
4-
"repositories": [
5-
{
6-
"type": "path",
7-
"url": "../pivotphp-core"
8-
}
9-
],
104
"keywords": [
115
"pivotphp",
126
"cycle-orm",
@@ -29,7 +23,7 @@
2923
],
3024
"require": {
3125
"php": "^8.1",
32-
"pivotphp/core": "*@dev",
26+
"pivotphp/core": "^1.1.0",
3327
"cycle/orm": "^2.10",
3428
"cycle/annotated": "^4.3",
3529
"cycle/migrations": "^4.2.5",
@@ -59,7 +53,7 @@
5953
"test:feature": "phpunit --testsuite=Feature",
6054
"test:integration": "phpunit --testsuite=Integration",
6155
"test:database": "phpunit --testsuite=Database",
62-
"test-coverage": "phpunit --coverage-html coverage",
56+
"test-coverage": "XDEBUG_MODE=coverage phpunit --coverage-html coverage --coverage-clover coverage.xml",
6357
"phpstan": "phpstan analyse src --level=9",
6458
"cs:check": "phpcs --standard=phpcs.xml --report=full",
6559
"cs:check:summary": "phpcs --standard=phpcs.xml --report=summary",

phpunit.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
colors="true"
55
failOnWarning="false"
66
failOnRisky="false"
7+
failOnDeprecation="false"
78
stopOnFailure="false"
89
cacheDirectory=".phpunit.cache"
910
executionOrder="depends,defects"
@@ -29,19 +30,17 @@
2930
</testsuite>
3031
</testsuites>
3132

32-
<coverage>
33+
34+
<source>
3335
<include>
3436
<directory suffix=".php">src/</directory>
3537
</include>
36-
<report>
37-
<clover outputFile="coverage.xml" />
38-
<html outputDirectory="coverage-html" />
39-
</report>
40-
</coverage>
38+
</source>
4139

4240
<php>
4341
<env name="APP_ENV" value="testing" />
4442
<env name="DB_CONNECTION" value="sqlite" />
4543
<env name="DB_DATABASE" value=":memory:" />
44+
<env name="XDEBUG_MODE" value="off" />
4645
</php>
4746
</phpunit>

src/Monitoring/MetricsCollector.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ public static function recordQueryTime(string $query, float $timeMs): void
7676
public static function recordQueryFailure(string $query): void
7777
{
7878
self::$metrics['queries_failed']++;
79-
error_log('Cycle ORM Query Failed: Query: ' . substr($query, 0, 100));
79+
80+
// Only log to error_log if not in testing environment
81+
$isTestingEnv = (
82+
(isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] === 'testing') ||
83+
(isset($_SERVER['APP_ENV']) && $_SERVER['APP_ENV'] === 'testing') ||
84+
defined('PHPUNIT_RUNNING')
85+
);
86+
87+
if (!$isTestingEnv) {
88+
error_log('Cycle ORM Query Failed: Query: ' . substr($query, 0, 100));
89+
}
8090
}
8191

8292
/**

0 commit comments

Comments
 (0)