mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Allow —no-dev install via a PHPUnit shim
Partially reinstates the 3.x style PhpUnitWrapper which was removed in d1af214ef5efb817c14b85b639525104d94ef2d9. While we no longer need the full wrapper, the part which creates a fake class is still useful. The preferred alternative would be to remove any references to SapphireTest from non-dev files, which mostly applies to SapphireTest::is_running_test(). This should be solved in a larger refactor of SapphireTest into optional traits and more fine grained functionality.
This commit is contained in:
parent
ff3ad6eb6b
commit
5a7c6d4f60
@ -74,7 +74,10 @@
|
||||
"SilverStripe\\View\\": "src/View/",
|
||||
"SilverStripe\\View\\Tests\\": "tests/php/View/"
|
||||
},
|
||||
"files": ["src/Core/Constants.php"],
|
||||
"files": [
|
||||
"src/Core/Constants.php",
|
||||
"src/Dev/PhpUnitShim.php"
|
||||
],
|
||||
"classmap": ["tests/behat/features/bootstrap"]
|
||||
},
|
||||
"include-path": [
|
||||
|
14
src/Dev/PhpUnitShim.php
Normal file
14
src/Dev/PhpUnitShim.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// Ensure this class can be autoloaded when installed without dev dependencies.
|
||||
// It's included by default through composer's autoloading.
|
||||
// class_exists() triggers PSR-4 autoloaders, which should discover if PHPUnit is installed.
|
||||
// TODO Factor out SapphireTest references from non-dev core code (avoid autoloading in the first place)
|
||||
namespace {
|
||||
|
||||
if (!class_exists('PHPUnit_Framework_TestCase')) {
|
||||
class PHPUnit_Framework_TestCase
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user