Created
April 8, 2024 10:59
-
-
Save szeidler/7989e724edb766bb6ff2ffff6aa0ead7 to your computer and use it in GitHub Desktop.
Test drush commands as a functional test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\Tests\staffing_figures_api\Functional; | |
use Drupal\taxonomy\Entity\Vocabulary; | |
use Drupal\Tests\BrowserTestBase; | |
use Drush\TestTraits\DrushTestTrait; | |
/** | |
* Tests the Drush commands provided by the staffing_figures_api module. | |
* | |
* @group staffing_figures_api | |
*/ | |
class DrushCommandsTest extends BrowserTestBase { | |
use DrushTestTrait; | |
/** | |
* {@inheritdoc} | |
*/ | |
protected $defaultTheme = 'stark'; | |
/** | |
* Modules to install. | |
* | |
* @var array | |
*/ | |
public static $modules = [ | |
'taxonomy', | |
'staffing_figures', | |
'staffing_figures_api', | |
]; | |
protected function setUp(): void { | |
parent::setUp(); | |
Vocabulary::create(['vid' => 'workplace', 'name' => 'Workplace'])->save(); | |
} | |
/** | |
* Tests the Drush commands | |
*/ | |
public function testDrushCommands() { | |
// Test the different drush commands are executed without errors. | |
// TODO: Extend the tests with proper test for results and return messges. | |
$this->drush('staffing-figures-api:generate:workplaces'); | |
$this->drush('staffing-figures-api:generate:file'); | |
$this->drush('staffing-figures-api:generate:file', [2020, 2, 1]); | |
$this->drush('staffing-figures-api:generate:merged', [1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment