/** * @param \CliTester $I */ public function testDocumentUsesRightStandard(\CliTester $I) { $I->wantTo('verify that the documentor uses the right standard'); $template = dirname(dirname(__DIR__)) . '/src/Task/CodeSniffer/codestyle.html'; $outfile = dirname(__DIR__) . '/_output/codestyle.html'; if (file_exists($outfile)) { unlink($outfile); } foreach (['Joomla', 'WordPress', 'PSR2'] as $standard) { $I->dontSeeFileFound($outfile); $I->runShellCommand("vendor/bin/robo document:codestyle --standard {$standard} --outfile {$outfile} --template {$template}"); $I->seeFileFound($outfile); $I->seeInThisFile("{$standard} Coding Standards"); unlink($outfile); } }
<?php $I = new CliTester($scenario); // prepare output folders $I->runShellCommand('mkdir -p /app/src/controllers/crud'); $I->runShellCommand('mkdir -p /app/src/models/crud/search'); // model & crud command $batch = <<<'CMD' /app/yii giiant-batch \ --interactive=0 \ --overwrite=1 \ --modelDb=db \ --modelBaseClass=yii\\db\\ActiveRecord \ --modelNamespace=app\\\models \ --crudControllerNamespace=app\\controllers\\crud \ --crudSearchModelNamespace=app\\models\\crud\\search \ --crudViewPath=@app/views/crud \ --crudPathPrefix=crud/ \ --tables=actor,film,film_actor,language,film_category,category,inventory,store,rental,payment,customer,staff,address,city,country CMD; $I->runShellCommand($batch); // assertions $I->dontSeeInShellOutput('Please fix the following errors'); $I->dontSeeInShellOutput('ErrorException'); $I->seeInShellOutput('The following files will be generated'); $I->seeFileFound('/app/src/controllers/crud/ActorController.php');
<?php $I = new CliTester($scenario); // prepare output folders $I->runShellCommand('mkdir -p /app/src/modules/employees/controllers'); $I->runShellCommand('mkdir -p /app/src/modules/employees/models/search'); // model & crud command $batch = <<<'CMD' /app/yii giiant-batch \ --interactive=0 \ --overwrite=1 \ --modelDb=db \ --modelBaseClass=yii\\db\\ActiveRecord \ --modelNamespace=app\\\models \ --crudControllerNamespace=app\\modules\\employees\\controllers \ --crudSearchModelNamespace=app\\modules\\employees\\models\\search \ --crudViewPath=@app/modules/employees/views \ --crudPathPrefix= CMD; $I->runShellCommand($batch); // assertions $I->dontSeeInShellOutput('Please fix the following errors'); $I->dontSeeInShellOutput('ErrorException'); $I->seeInShellOutput('The following files will be generated'); $I->seeFileFound('/app/src/modules/employees/controllers/DepartmentController.php');
<?php $I = new CliTester($scenario); $moduleCmd = <<<'CMD' yii gii/giiant-module \ --interactive=0 \ --overwrite=1 \ --moduleID=tagai \ --moduleClass=app\\modules\\tagai\\Module CMD; $I->runShellCommand($moduleCmd); $I->seeFileFound('/app/src/modules/tagai/Module.php'); // prepare output folders $I->runShellCommand('mkdir -p /app/src/modules/tagai/controllers'); $I->runShellCommand('mkdir -p /app/src/modules/tagai/models/search'); // model & crud command $batch = <<<'CMD' /app/yii giiant-batch \ --interactive=0 \ --overwrite=1 \ --modelDb=db \ --modelBaseClass=yii\\db\\ActiveRecord \ --modelNamespace=app\\modules\\tagai\\models \ --modelRemoveDuplicateRelations=1 \ --crudTidyOutput=1 \ --crudAccessFilter=1 \ --crudControllerNamespace=app\\modules\\tagai\\controllers \ --crudSearchModelNamespace=app\\modules\\tagai\\models\\search \ --crudViewPath=@app/modules/tagai/views \ --crudPathPrefix= \ --crudSkipRelations=Variant,Variants \
<?php // @group onlyCrud $name = 'onlyCrud'; $I = new CliTester($scenario); // prepare output folders $I->runShellCommand("mkdir -p /app/src/controllers/{$name}"); $I->runShellCommand("mkdir -p /app/src/models/{$name}/search"); // model & crud command $batch = <<<CMD /app/yii giiant-batch/cruds \\ --interactive=0 \\ --overwrite=1 \\ --modelNamespace=tests\\\\models \\ --crudControllerNamespace=app\\\\controllers\\\\{$name} \\ --crudSearchModelNamespace=app\\\\models\\\\{$name}\\\\search \\ --crudViewPath=@app/views/{$name} \\ --crudPathPrefix={$name}/ \\ --crudSkipRelations=Variant,Variants \\ --crudProviders=schmunk42\\\\giiant\\\\generators\\\\crud\\\\providers\\\\extensions\\\\EditorProvider \\ --tables=country CMD; $I->runShellCommand($batch); // assertions $I->dontSeeInShellOutput('Please fix the following errors'); $I->dontSeeInShellOutput('ErrorException'); $I->seeInShellOutput('The following files will be generated'); $I->seeFileFound("/app/src/controllers/{$name}/CountryController.php");
<?php $I = new CliTester($scenario); // prepare output folders $I->runShellCommand('mkdir -p /app/src/controllers/crud'); $I->runShellCommand('mkdir -p /app/src/models/crud/search'); // model & crud command $batch = <<<'CMD' /app/yii giiant-batch \ --interactive=0 \ --overwrite=1 \ --modelDb=db \ --modelBaseClass=yii\\db\\ActiveRecord \ --modelNamespace=app\\\models \ --crudControllerNamespace=app\\controllers\\crud \ --crudSearchModelNamespace=app\\models\\crud\\search \ --crudViewPath=@app/views/crud \ --crudPathPrefix=crud/ \ --crudSkipRelations=Variant,Variants \ --crudProviders=schmunk42\\giiant\\generators\\crud\\providers\\optsProvider \ --tables=actor,film,film_actor,language,film_category,category,inventory,store,rental,payment,customer,staff,address,city,country CMD; $I->runShellCommand($batch); // assertions $I->dontSeeInShellOutput('Please fix the following errors'); $I->dontSeeInShellOutput('ErrorException'); $I->seeInShellOutput('The following files will be generated'); $I->seeFileFound('/app/src/controllers/crud/CountryController.php');
<?php // @group sakila $I = new CliTester($scenario); // TODO: it should not be required to prepare output folders $I->runShellCommand('mkdir -p /app/src/modules/sakila/controllers'); $I->runShellCommand('mkdir -p /app/src/modules/sakila/models/search'); $moduleCmd = <<<'CMD' yii gii/giiant-module \ --interactive=0 \ --overwrite=1 \ --moduleID=sakila \ --moduleClass=app\\modules\\sakila\\Module CMD; $I->runShellCommand($moduleCmd); $I->seeFileFound('/app/src/modules/sakila/Module.php'); // model & crud command $batch = <<<'CMD' /app/yii giiant-batch \ --interactive=0 \ --overwrite=1 \ --modelDb=db \ --modelBaseClass=yii\\db\\ActiveRecord \ --modelNamespace=app\\modules\\sakila\\models \ --modelQueryNamespace=app\\modules\\sakila\\models\\query \ --crudAccessFilter=1 \ --crudControllerNamespace=app\\modules\\sakila\\controllers \ --crudSearchModelNamespace=app\\modules\\sakila\\models\\search \ --crudViewPath=@app/modules/sakila/views \ --crudPathPrefix= \ --crudSkipRelations=Variant,Variants \