Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Console/Commands/ModulesSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

class ModulesSync extends Command
{
protected $signature = 'modules:sync {--no-phpstorm : Do not update PhpStorm config files}';
protected $signature = 'modules:sync
{--no-phpstorm : Do not update PhpStorm config files}
{--no-phpunit : Do not update phpunit.xml file}';

protected $description = 'Sync your project\'s configuration with your current modules';

Expand All @@ -32,8 +34,10 @@ public function handle(ModuleRegistry $registry, Filesystem $filesystem)
{
$this->filesystem = $filesystem;
$this->registry = $registry;

$this->updatePhpUnit();

if (true !== $this->option('no-phpunit')) {
$this->updatePhpUnit();
}

if (true !== $this->option('no-phpstorm')) {
$this->updatePhpStormConfig();
Expand Down
19 changes: 18 additions & 1 deletion tests/Commands/ModulesSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_it_updates_phpunit_config(): void

$this->assertCount(1, $nodes);
}

public function test_it_updates_phpstorm_plugin_config(): void
{
$config_path = $this->copyStub('laravel-plugin.xml', '.idea');
Expand Down Expand Up @@ -120,4 +120,21 @@ public function test_it_updates_phpstorm_iml_file(): void

$this->assertCount(6, $nodes);
}

public function test_it_skips_updating_phpunit_config_with_flag(): void
{
$config_path = $this->copyStub('phpunit.xml', '/');

$config = simplexml_load_string($this->filesystem->get($config_path));
$nodes = $config->xpath("//phpunit//testsuites//testsuite//directory[text()='./app-modules/*/tests']");

$this->assertCount(0, $nodes);

$this->artisan(ModulesSync::class, ['--no-phpunit' => true]);

$config = simplexml_load_string($this->filesystem->get($config_path));
$nodes = $config->xpath("//phpunit//testsuites//testsuite//directory[text()='./app-modules/*/tests']");

$this->assertCount(0, $nodes);
}
}
Loading