File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ The `phpunit.xml.dist` file is used as the default configuration file for the
34
34
test suite. In addition to various PHPUnit options, it defines required
35
35
` MONGODB_URI ` and ` MONGODB_DATABASE ` environment variables. You may customize
36
36
this configuration by creating your own ` phpunit.xml ` file based on the
37
- ` phpunit.xml.dist ` file we provide.
37
+ ` phpunit.xml.dist ` file we provide. To run the tests in serverless mode, set the
38
+ ` MONGODB_IS_SERVERLESS ` environment variable to ` on ` .
38
39
39
40
By default, the ` simple-phpunit ` binary chooses the correct PHPUnit version for
40
41
the PHP version you are running. To run tests against a specific PHPUnit version,
Original file line number Diff line number Diff line change 19
19
20
20
use function call_user_func ;
21
21
use function count ;
22
+ use function filter_var ;
22
23
use function gc_collect_cycles ;
24
+ use function getenv ;
23
25
use function in_array ;
24
26
use function is_string ;
25
27
use function PHPUnit \Framework \assertContainsOnly ;
33
35
use function strpos ;
34
36
use function version_compare ;
35
37
38
+ use const FILTER_VALIDATE_BOOLEAN ;
39
+
36
40
/**
37
41
* Unified test runner.
38
42
*
@@ -339,8 +343,9 @@ private function isAuthenticated(): bool
339
343
*/
340
344
private function isServerless (): bool
341
345
{
342
- // TODO: detect serverless once PHPC-1755 is implemented
343
- return false ;
346
+ $ isServerless = getenv ('MONGODB_IS_SERVERLESS ' );
347
+
348
+ return $ isServerless !== false ? filter_var ($ isServerless , FILTER_VALIDATE_BOOLEAN ) : false ;
344
349
}
345
350
346
351
/**
You can’t perform that action at this time.
0 commit comments