Skip to content

Instantly share code, notes, and snippets.

@ScopeyNZ
Last active July 26, 2018 05:29
Show Gist options
  • Save ScopeyNZ/8e28c5f29f2269537ecb41c035868ce7 to your computer and use it in GitHub Desktop.
Save ScopeyNZ/8e28c5f29f2269537ecb41c035868ce7 to your computer and use it in GitHub Desktop.
Show the modules that are installed that aren't part of a test suite (for use with recipes)
<?php
$lock = json_decode(file_get_contents("composer.lock"), true);
$testXML = file_get_contents('phpunit.xml.dist');
foreach ($lock['packages'] as $package) {
if (strpos($package['type'], 'silverstripe') !== false && strpos($testXML, $package['name']) === false) {
// Attempt to locate a test folder
$directory = 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package['name']). DIRECTORY_SEPARATOR;
if (is_dir($directory) && is_dir($directory .'tests')) {
echo $package['name'].PHP_EOL;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment