本文整理汇总了PHP中AcceptanceTester::seeFileContentsEqual方法的典型用法代码示例。如果您正苦于以下问题:PHP AcceptanceTester::seeFileContentsEqual方法的具体用法?PHP AcceptanceTester::seeFileContentsEqual怎么用?PHP AcceptanceTester::seeFileContentsEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcceptanceTester
的用法示例。
在下文中一共展示了AcceptanceTester::seeFileContentsEqual方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AcceptanceTester
$I = new AcceptanceTester($scenario);
$I->wantTo('generate a model without fillable fields or dates');
$I->runShellCommand('php artisan wn:model TestingModel --path=tests/tmp');
$I->seeInShellOutput('TestingModel model generated');
$I->seeFileFound('./tests/tmp/TestingModel.php');
$I->openFile('./tests/tmp/TestingModel.php');
$I->seeFileContentsEqual('<?php namespace Tests\\Tmp;
use Illuminate\\Database\\Eloquent\\Model;
class TestingModel extends Model {
protected $fillable = [];
protected $dates = [];
public static $rules = [
// Validation rules
];
// Relationships
}
');
$I->wantTo('generate a model with fillable fields');
$I->runShellCommand('php artisan wn:model TestingModel --fillable=name,title --path=tests/tmp');
$I->seeFileFound('./tests/tmp/TestingModel.php');
$I->openFile('./tests/tmp/TestingModel.php');
$I->seeInThisFile('protected $fillable = ["name", "title"];');
$I->wantTo('generate a model with dates fields');
$I->runShellCommand('php artisan wn:model TestingModel --dates=started_at --path=tests/tmp');
示例2: use
$I->runShellCommand('mkdir ' . $outputPath);
$I->runShellCommand('php extract_markdown_codes.php ' . $inputPath . ' list ' . $outputPath);
// assertions
$I->amInPath($outputPath);
// list1
(function () use($I) {
$I->openFile('list001.txt');
$contents = <<<EOT
// list1
require_once __DIR__ . '/vendor/autoload.php';
\$foo = new Foo();
\$foo->execute();
EOT;
$I->seeFileContentsEqual($contents);
})();
// list2
(function () use($I) {
$I->openFile('list002.txt');
$contents = <<<EOT
// list2
\$i = 2;
EOT;
$I->seeFileContentsEqual($contents);
})();
// list3
(function () use($I) {
$I->openFile('list003.txt');
$contents = <<<EOT
示例3: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('Generate the full structure of a new module for Backbone / RequireJS');
// Make sure that we're dealing with a clean directory
$I->cleanDir('tests/tmp');
$I->runShellCommand('php ../../../artisan modules:generate taco --path=tests/tmp/modules');
$I->seeInShellOutput('Successfully created 4 files');
$I->openFile('tests/tmp/modules/tacos/models/taco.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/model.stub'));
$I->openFile('tests/tmp/modules/tacos/collections/tacos.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/collection.stub'));
$I->openFile('tests/tmp/modules/tacos/views/taco_view.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/view.stub'));
$I->openFile('tests/tmp/modules/tacos/index.js');
$I->seeFileContentsEqual(file_get_Contents('tests/acceptance/stubs/index.stub'));
$I->cleanDir('tests/tmp');
示例4: up
$I->openFile('./database/migrations/pivot_table.php');
$I->seeFileContentsEqual('<?php
use Illuminate\\Database\\Schema\\Blueprint;
use Illuminate\\Database\\Migrations\\Migration;
class CreateProjectTagTable extends Migration
{
public function up()
{
Schema::create(\'project_tag\', function(Blueprint $table) {
$table->increments(\'id\');
$table->integer(\'project_id\')->unsigned()->index();
$table->integer(\'tag_id\')->unsigned()->index();
$table->foreign(\'project_id\')
->references(\'id\')
->on(\'projects\');
$table->foreign(\'tag_id\')
->references(\'id\')
->on(\'tags\');
$table->timestamps();
});
}
public function down()
{
Schema::drop(\'project_tag\');
}
}
');
$I->deleteFile('./database/migrations/pivot_table.php');
示例5: AcceptanceTester
<?php
$saveDir = './tests/acceptance/tmp';
$stubDir = './tests/acceptance/stubs';
$queryToGenerate = 'FooQuery';
$I = new AcceptanceTester($scenario);
$I->wantTo('generate a query and handler class');
$I->runShellCommand("php ../../../artisan querier:generate {$queryToGenerate} --properties='bar, baz' --base='{$saveDir}'");
$I->seeInShellOutput('All done!');
// My Command stub should match the generated class.
$I->openFile("{$saveDir}/{$queryToGenerate}.php");
$I->seeFileContentsEqual(file_get_contents("{$stubDir}/{$queryToGenerate}.stub"));
// And my QueryHandler stub should match its generated counterpart, as well.
$I->openFile("{$saveDir}/{$queryToGenerate}Handler.php");
$I->seeFileContentsEqual(file_get_contents("{$stubDir}/{$queryToGenerate}Handler.stub"));
$I->cleanDir($saveDir);
示例6: up
$I->runShellCommand('php artisan wn:migration tasks --file=create_tasks');
$I->seeInShellOutput('tasks migration generated');
$I->seeFileFound('./database/migrations/create_tasks.php');
$I->openFile('./database/migrations/create_tasks.php');
$I->seeFileContentsEqual('<?php
use Illuminate\\Database\\Schema\\Blueprint;
use Illuminate\\Database\\Migrations\\Migration;
class CreateTasksMigration extends Migration
{
public function up()
{
Schema::create(\'tasks\', function(Blueprint $table) {
$table->increments(\'id\');
// Schema declaration
// Constraints declaration
$table->timestamps();
});
}
public function down()
{
Schema::drop(\'tasks\');
}
}
');
$I->deleteFile('./database/migrations/create_tasks.php');
$I->wantTo('generate a migration with schema');
$I->runShellCommand('php artisan wn:migration tasks --file=create_tasks --schema="amount:decimal.5,2:after.\'size\':default.8 title:string:nullable"');
$I->seeInShellOutput('tasks migration generated');
示例7: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('generate both a command and a hndler class');
$I->runShellCommand('php artisan commander:generate Acme/Bar/FooCommand --properties="bar, baz" --base="tests/tmp"');
$I->seeInShellOutput('All done!');
$I->openFile('tests/tmp/Acme/Bar/FooCommand.php');
$I->seeFileContentsEqual(file_get_contents('tests/acceptance/stub/FooCommand.stub'));
//$I->seeFileFound('tests/tmp/FooCommandHandler.php');
示例8: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('generate a RESTful controller with short model name');
$I->runShellCommand('php artisan wn:controller Test --no-routes');
$I->seeInShellOutput('TestsController generated');
$I->seeFileFound('./app/Http/Controllers/TestsController.php');
$I->openFile('./app/Http/Controllers/TestsController.php');
$I->seeFileContentsEqual('<?php namespace App\\Http\\Controllers;
class TestsController extends Controller {
const MODEL = "App\\Test";
use RESTActions;
}
');
$I->deleteFile('./app/Http/Controllers/TestsController.php');
$I->wantTo('generate a RESTful controller with full model name and routes');
$I->runShellCommand('php artisan wn:controller "App\\Models\\Category"');
$I->seeInShellOutput('CategoriesController generated');
$I->seeFileFound('./app/Http/Controllers/CategoriesController.php');
$I->openFile('./app/Http/Controllers/CategoriesController.php');
$I->seeFileContentsEqual('<?php namespace App\\Http\\Controllers;
class CategoriesController extends Controller {
const MODEL = "App\\Models\\Category";