Skip to content

Commit bf321e6

Browse files
committed
test(ffe): run span-enrichment .phpt under the PHPUnit featureflags suite instead of ext
1 parent c1e430a commit bf321e6

4 files changed

Lines changed: 16 additions & 36 deletions

File tree

tests/ext/ffe/span_enrichment_concurrent_roots.phpt renamed to tests/OpenFeature/span_enrichment_concurrent_roots.phpt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
FFE span enrichment: concurrently-open root spans each keep their own tags
3-
--SKIPIF--
4-
<?php
5-
if (getenv('PHP_PEAR_RUNTESTS') === '1') {
6-
die('skip: the src/ PHP API is not shipped in the PECL test package');
7-
}
8-
?>
93
--INI--
104
datadog.trace.generate_root_span=0
115
datadog.experimental_flagging_provider_span_enrichment_enabled=1
@@ -18,11 +12,10 @@ use DDTrace\FeatureFlags\EvaluationType;
1812
use DDTrace\FeatureFlags\SpanEnrichmentAccumulator;
1913
use DDTrace\FeatureFlags\SpanEnrichmentRegistry;
2014

21-
$root = getenv('TEST_PHP_SRCDIR');
22-
if (!is_string($root) || $root === '') {
23-
$root = dirname(dirname(dirname(__DIR__)));
24-
}
25-
require_once $root . '/src/DDTrace/Util/ObjectKVStore.php';
15+
// Runs under the PHPUnit `featureflags` suite (PHP 8.0+), CWD = repo root. The
16+
// DDTrace API classes are plain PHP under src/; load them explicitly (the
17+
// OpenFeature composer autoload does not map the DDTrace namespace).
18+
require_once './src/DDTrace/Util/ObjectKVStore.php';
2619
foreach (array(
2720
'EvaluationType',
2821
'EvaluationReason',
@@ -31,7 +24,7 @@ foreach (array(
3124
'SpanEnrichmentAccumulator',
3225
'SpanEnrichmentRegistry',
3326
) as $classFile) {
34-
require_once $root . '/src/api/FeatureFlags/' . $classFile . '.php';
27+
require_once './src/api/FeatureFlags/' . $classFile . '.php';
3528
}
3629

3730
function show($label, $value) {

tests/ext/ffe/span_enrichment_gate_off.phpt renamed to tests/OpenFeature/span_enrichment_gate_off.phpt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
FFE span enrichment: gate off writes no ffe_* tags onto the root span
3-
--SKIPIF--
4-
<?php
5-
if (getenv('PHP_PEAR_RUNTESTS') === '1') {
6-
die('skip: the src/ PHP API is not shipped in the PECL test package');
7-
}
8-
?>
93
--INI--
104
datadog.experimental_flagging_provider_span_enrichment_enabled=0
115
--FILE--
@@ -16,11 +10,10 @@ use DDTrace\FeatureFlags\EvaluationReason;
1610
use DDTrace\FeatureFlags\EvaluationType;
1711
use DDTrace\FeatureFlags\SpanEnrichmentRegistry;
1812

19-
$root = getenv('TEST_PHP_SRCDIR');
20-
if (!is_string($root) || $root === '') {
21-
$root = dirname(dirname(dirname(__DIR__)));
22-
}
23-
require_once $root . '/src/DDTrace/Util/ObjectKVStore.php';
13+
// Runs under the PHPUnit `featureflags` suite (PHP 8.0+), CWD = repo root. The
14+
// DDTrace API classes are plain PHP under src/; load them explicitly (the
15+
// OpenFeature composer autoload does not map the DDTrace namespace).
16+
require_once './src/DDTrace/Util/ObjectKVStore.php';
2417
foreach (array(
2518
'EvaluationType',
2619
'EvaluationReason',
@@ -29,7 +22,7 @@ foreach (array(
2922
'SpanEnrichmentAccumulator',
3023
'SpanEnrichmentRegistry',
3124
) as $classFile) {
32-
require_once $root . '/src/api/FeatureFlags/' . $classFile . '.php';
25+
require_once './src/api/FeatureFlags/' . $classFile . '.php';
3326
}
3427

3528
function show($label, $value) {

tests/ext/ffe/span_enrichment_root_meta.phpt renamed to tests/OpenFeature/span_enrichment_root_meta.phpt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
--TEST--
22
FFE span enrichment: evaluations aggregate onto the active root span's meta
3-
--SKIPIF--
4-
<?php
5-
if (getenv('PHP_PEAR_RUNTESTS') === '1') {
6-
die('skip: the src/ PHP API is not shipped in the PECL test package');
7-
}
8-
?>
93
--INI--
104
datadog.experimental_flagging_provider_span_enrichment_enabled=1
115
--FILE--
@@ -17,11 +11,10 @@ use DDTrace\FeatureFlags\EvaluationType;
1711
use DDTrace\FeatureFlags\SpanEnrichmentAccumulator;
1812
use DDTrace\FeatureFlags\SpanEnrichmentRegistry;
1913

20-
$root = getenv('TEST_PHP_SRCDIR');
21-
if (!is_string($root) || $root === '') {
22-
$root = dirname(dirname(dirname(__DIR__)));
23-
}
24-
require_once $root . '/src/DDTrace/Util/ObjectKVStore.php';
14+
// Runs under the PHPUnit `featureflags` suite (PHP 8.0+), CWD = repo root. The
15+
// DDTrace API classes are plain PHP under src/; load them explicitly (the
16+
// OpenFeature composer autoload does not map the DDTrace namespace).
17+
require_once './src/DDTrace/Util/ObjectKVStore.php';
2518
foreach (array(
2619
'EvaluationType',
2720
'EvaluationReason',
@@ -30,7 +23,7 @@ foreach (array(
3023
'SpanEnrichmentAccumulator',
3124
'SpanEnrichmentRegistry',
3225
) as $classFile) {
33-
require_once $root . '/src/api/FeatureFlags/' . $classFile . '.php';
26+
require_once './src/api/FeatureFlags/' . $classFile . '.php';
3427
}
3528

3629
function show($label, $value) {

tests/phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
</testsuite>
144144
<testsuite name="featureflags">
145145
<directory phpVersion="8.0.0" phpVersionOperator="&gt;=">./OpenFeature/</directory>
146+
<directory suffix=".phpt" phpVersion="8.0.0" phpVersionOperator="&gt;=">./OpenFeature/</directory>
146147
</testsuite>
147148
</testsuites>
148149

0 commit comments

Comments
 (0)