当前位置: 首页>>代码示例>>PHP>>正文


PHP AcceptanceTester::seeInThisFile方法代码示例

本文整理汇总了PHP中AcceptanceTester::seeInThisFile方法的典型用法代码示例。如果您正苦于以下问题:PHP AcceptanceTester::seeInThisFile方法的具体用法?PHP AcceptanceTester::seeInThisFile怎么用?PHP AcceptanceTester::seeInThisFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AcceptanceTester的用法示例。


在下文中一共展示了AcceptanceTester::seeInThisFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: accounts

	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');
$I->seeFileFound('./tests/tmp/TestingModel.php');
$I->openFile('./tests/tmp/TestingModel.php');
$I->seeInThisFile('protected $dates = ["started_at"];');
$I->wantTo('generate a model with relations');
$I->runShellCommand('php artisan wn:model TestingModel --has-many=accounts --belongs-to="owner:App\\User" --has-one=number:Phone --path=tests/tmp');
$I->seeFileFound('./tests/tmp/TestingModel.php');
$I->openFile('./tests/tmp/TestingModel.php');
$I->seeInThisFile('
	public function accounts()
	{
		return $this->hasMany("Tests\\Tmp\\Account");
	}
');
开发者ID:nasrulhazim,项目名称:lumen-generators,代码行数:30,代码来源:ModelCommandCept.php

示例2: tags

<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('generate a RESTful resource');
$I->runShellCommand('php artisan wn:resource task_category "name;string:unique;requied;fillable descr;text:nullable;;fillable project_id;integer;required;key,fillable due;timestamp;;fillable,date" --has-many="tags,tasks" --belongs-to="project,creator:User" --migration-file=create_task_categories');
// Checking the model
$I->seeInShellOutput('TaskCategory model generated');
$I->seeFileFound('./app/TaskCategory.php');
$I->openFile('./app/TaskCategory.php');
$I->seeInThisFile('namespace App;');
$I->seeInThisFile('class TaskCategory extends Model');
$I->seeInThisFile('protected $fillable = ["name", "descr", "project_id", "due"];');
$I->seeInThisFile('protected $dates = ["due"];');
$I->seeInThisFile('public static $rules = [
		"name" => "requied",
		"project_id" => "required",
	];');
$I->seeInThisFile('
	public function tags()
	{
		return $this->hasMany("App\\Tag");
	}

	public function tasks()
	{
		return $this->hasMany("App\\Task");
	}

	public function project()
	{
		return $this->belongsTo("App\\Project");
开发者ID:nhahv,项目名称:lumen-generators,代码行数:31,代码来源:ResourceCommandCept.php

示例3: AcceptanceTester

<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('generate RESTful routes for a resource with default controller');
$I->runShellCommand('php artisan wn:route project-type');
$I->seeInShellOutput('project-type routes generated');
$I->openFile('./app/Http/routes.php');
$I->seeInThisFile("\n\$app->get('project-type', 'ProjectTypesController@all');\n\$app->get('project-type/{id}', 'ProjectTypesController@get');\n\$app->post('project-type', 'ProjectTypesController@add');\n\$app->put('project-type/{id}', 'ProjectTypesController@put');\n\$app->delete('project-type/{id}', 'ProjectTypesController@remove');\n");
$I->writeToFile('./app/Http/routes.php', '<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$app->get("/", function () use ($app) {
    return $app->welcome();
});
');
$I->wantTo('generate RESTful routes for a resource with custom controller');
$I->runShellCommand('php artisan wn:route foo --controller=customController');
$I->seeInShellOutput('foo routes generated');
$I->openFile('./app/Http/routes.php');
$I->seeInThisFile("\n\$app->get('foo', 'customController@all');\n\$app->get('foo/{id}', 'customController@get');\n\$app->post('foo', 'customController@add');\n\$app->put('foo/{id}', 'customController@put');\n\$app->delete('foo/{id}', 'customController@remove');\n");
$I->writeToFile('./app/Http/routes.php', '<?php
开发者ID:nasrulhazim,项目名称:lumen-generators,代码行数:31,代码来源:RouteCommandCept.php

示例4: up

    public function up()
    {
        Schema::create(\'tasks\', function(Blueprint $table) {
            $table->increments(\'id\');
            $table->decimal(\'amount\', 5, 2)->after(\'size\')->default(8);
            $table->string(\'title\')->nullable();
            // Constraints declaration
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::drop(\'tasks\');
    }
}
');
$I->deleteFile('./database/migrations/create_tasks.php');
$I->wantTo('generate a migration with schema and foreign keys');
$I->runShellCommand('php artisan wn:migration tasks --file=create_tasks --keys="category_type_id user_id:identifier:members:cascade" --schema="amount:decimal.5,2:after.\'size\':default.8 title:string:nullable"');
$I->seeInShellOutput('tasks migration generated');
$I->seeFileFound('./database/migrations/create_tasks.php');
$I->openFile('./database/migrations/create_tasks.php');
$I->seeInThisFile('$table->foreign(\'category_type_id\')
                ->references(\'id\')
                ->on(\'category_types\');');
$I->seeInThisFile('$table->foreign(\'user_id\')
                ->references(\'identifier\')
                ->on(\'members\')
                ->onDelete(\'cascade\');');
$I->deleteFile('./database/migrations/create_tasks.php');
开发者ID:nhahv,项目名称:lumen-generators,代码行数:31,代码来源:MigrationCommandCept.php

示例5: AcceptanceTester

<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('generate the REST actions trait');
$I->runShellCommand('php artisan wn:controller:rest-actions');
$I->seeInShellOutput('REST actions trait generated');
$I->seeFileFound('./app/Http/Controllers/RESTActions.php');
$I->openFile('./app/Http/Controllers/RESTActions.php');
$I->seeInThisFile('trait RESTActions {');
$I->deleteFile('./app/Http/Controllers/RESTActions.php');
开发者ID:nasrulhazim,项目名称:lumen-generators,代码行数:10,代码来源:ControllerRestActionsCommandCept.php

示例6: function

$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";

	use RESTActions;

}
');
$I->deleteFile('./app/Http/Controllers/CategoriesController.php');
$I->openFile('./app/Http/routes.php');
$I->seeInThisFile("\n\$app->get('category', 'CategoriesController@all');\n\$app->get('category/{id}', 'CategoriesController@get');\n\$app->post('category', 'CategoriesController@add');\n\$app->put('category/{id}', 'CategoriesController@put');\n\$app->delete('category/{id}', 'CategoriesController@remove');\n");
$I->writeToFile('./app/Http/routes.php', '<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$app->get("/", function () use ($app) {
    return $app->welcome();
开发者ID:nasrulhazim,项目名称:lumen-generators,代码行数:31,代码来源:ControllerCommandCept.php


注:本文中的AcceptanceTester::seeInThisFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。