Run all tests in os group when testing specific OS (#9235)

https://phpunit.de/manual/6.5/en/textui.html#textui.examples.filter-patterns

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
This commit is contained in:
Tony Murray
2018-09-19 17:18:15 -05:00
committed by Neil Lathwood
parent fc12175ee0
commit 2c7a19712f
2 changed files with 11 additions and 7 deletions

View File

@ -334,7 +334,8 @@ function check_unit($passthru = false, $command_only = false, $options = array()
if ($options['os']) {
$filter = implode('.*|', (array)$options['os']);
$phpunit_cmd .= " --group os --filter \"@($filter.*)\"";
// include tests that don't have data providers and only data sets that match
$phpunit_cmd .= " --group os --filter '/::test[A-Za-z]+$|::test[A-Za-z]+ with data set \"$filter.*\"$/'";
}
if ($options['module']) {
@ -368,15 +369,12 @@ function check_unit($passthru = false, $command_only = false, $options = array()
* Check if the given options array contains any of the $opts specified
*
* @param array $options the array from getopt()
* @param string $opts,... options to check for
* @param string ...$opts options to check for
* @return bool If one of the specified options is set
*/
function check_opt($options)
function check_opt($options, ...$opts)
{
$args = func_get_args();
array_shift($args);
foreach ($args as $option) {
foreach ($opts as $option) {
if (isset($options[$option])) {
if ($options[$option] === false) {
// no data, return that option is enabled

View File

@ -33,11 +33,17 @@ use Symfony\Component\Yaml\Yaml;
class YamlTest extends TestCase
{
/**
* @group os
*/
public function testOSDefinitionSchema()
{
$this->validateYamlFilesAgainstSchema('/includes/definitions', '/misc/os_schema.json');
}
/**
* @group os
*/
public function testDiscoveryDefinitionSchema()
{
$this->validateYamlFilesAgainstSchema('/includes/definitions/discovery', '/misc/discovery_schema.json');