Ejemplo n.º 1
0
 /**
  * @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');
Ejemplo n.º 4
0
<?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 \
Ejemplo n.º 5
0
<?php

$I = new CliTester($scenario);
$I->wantTo('check asset bundling');
$I->runShellCommand('mkdir -p web/assets-prod/js');
$I->runShellCommand('mkdir -p web/assets-prod/css');
$I->runShellCommand('yii asset src/config/assets-prod.php src/config/bundle-prod.php');
$I->seeInShellOutput('Output bundle configuration created at');
<?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");
Ejemplo n.º 7
0
<?php

// @group mandatory
$I = new CliTester($scenario);
$I->runShellCommand('yii');
$I->seeInShellOutput('This is Yii version 2.0.');
Ejemplo n.º 8
0
<?php

// @group mandatory
$I = new CliTester($scenario);
$I->runShellCommand('/app/yii');
$I->seeInShellOutput('This is Yii version 2.0.');
Ejemplo n.º 9
0
<?php

// @group mandatory
$I = new CliTester($scenario);
$I->runShellCommand("yii help gii");
$I->seeInShellOutput('DESCRIPTION');
$I->seeInShellOutput('SUB-COMMANDS');
$I->seeInShellOutput('gii/');
$I->runShellCommand("yii help gii/giiant-crud");
$I->seeInShellOutput('DESCRIPTION');
$I->seeInShellOutput('yii gii/giiant-crud');
Ejemplo n.º 10
0
<?php

// @group sakila
$I = new CliTester($scenario);
// TODO: it should not be required to prepare output folders
$I->runShellCommand('mkdir -p /app/src/modules/backend/controllers/crud');
$I->runShellCommand('mkdir -p /app/src/common/backend/models/search');
$moduleCmd = <<<'CMD'
yii gii/giiant-module \
    --interactive=0 \
    --overwrite=1 \
    --moduleID=backend2 \
    --moduleClass=app\\modules\\backend\\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 \
    --modelQueryNamespace=app\\modules\\backend\\models\\query \
    --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/modules/sakila/controllers/ActorController.php');
$I->seeFileFound('/app/src/modules/sakila/models/Actor.php');