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');
Ejemplo n.º 3
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');
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 \
<?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.º 6
0
<?php

// @group mandatory
$I = new CliTester($scenario);
$I->runShellCommand('yii');
$I->seeInShellOutput('This is Yii version 2.0.');
Ejemplo n.º 7
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');