createList() public static method

public static createList ( $class, $dataList = [] )
示例#1
0
 public function test_Should_GetUsersByPage()
 {
     Factory::createList('App\\Models\\User', [['name' => 'User 1', 'email' => '*****@*****.**', 'password' => '12345678', 'api_token' => '12345678'], ['name' => 'User 2', 'email' => '*****@*****.**', 'password' => '23456789', 'api_token' => '23456789'], ['name' => 'User 3', 'email' => '*****@*****.**', 'password' => '34567890', 'api_token' => '34567890'], ['name' => 'User 4', 'email' => '*****@*****.**', 'password' => '4567890a', 'api_token' => '45678901'], ['name' => 'User 5', 'email' => '*****@*****.**', 'password' => '567890ab', 'api_token' => '56789012']]);
     $userRepository = new EloquentUser(new App\Models\User());
     $foundUsers = $userRepository->byPage();
     $this->assertCount(5, $foundUsers->items());
 }
示例#2
0
 public function test_Should_GetRolesByPage()
 {
     Factory::createList('Kodeine\\Acl\\Models\\Eloquent\\Role', [['name' => 'Role 1', 'slug' => 'role_1', 'description' => ''], ['name' => 'Role 2', 'slug' => 'role_2', 'description' => ''], ['name' => 'Role 3', 'slug' => 'role_3', 'description' => ''], ['name' => 'Role 4', 'slug' => 'role_4', 'description' => ''], ['name' => 'Role 5', 'slug' => 'role_5', 'description' => '']]);
     $serverRepository = new EloquentRole(new Kodeine\Acl\Models\Eloquent\Role());
     $foundRoles = $serverRepository->byPage();
     $this->assertCount(5, $foundRoles->items());
 }
示例#3
0
 public function test_Should_GetServersByPage()
 {
     Factory::createList('App\\Models\\Server', [['name' => 'Server 1', 'description' => '', 'body' => ''], ['name' => 'Server 2', 'description' => '', 'body' => ''], ['name' => 'Server 3', 'description' => '', 'body' => ''], ['name' => 'Server 4', 'description' => '', 'body' => ''], ['name' => 'Server 5', 'description' => '', 'body' => '']]);
     $serverRepository = new EloquentServer(new App\Models\Server());
     $foundServers = $serverRepository->byPage();
     $this->assertCount(5, $foundServers->items());
 }
示例#4
0
 public function test_Should_GetRecipesByPage()
 {
     Factory::createList('App\\Models\\Recipe', [['name' => 'Recipe 1', 'description' => '', 'body' => ''], ['name' => 'Recipe 2', 'description' => '', 'body' => ''], ['name' => 'Recipe 3', 'description' => '', 'body' => ''], ['name' => 'Recipe 4', 'description' => '', 'body' => ''], ['name' => 'Recipe 5', 'description' => '', 'body' => '']]);
     $recipeRepository = new EloquentRecipe(new App\Models\Recipe());
     $foundRecipes = $recipeRepository->byPage();
     $this->assertCount(5, $foundRecipes->items());
 }
示例#5
0
 public function test_Should_GetProjectsByPage()
 {
     $arrangedServer = Factory::create('App\\Models\\Server', ['name' => 'Recipe 1', 'description' => '', 'body' => '']);
     Factory::createList('App\\Models\\Project', [['name' => 'Project 1', 'server_id' => $arrangedServer->id, 'stage' => 'staging'], ['name' => 'Project 2', 'server_id' => $arrangedServer->id, 'stage' => 'staging'], ['name' => 'Project 3', 'server_id' => $arrangedServer->id, 'stage' => 'staging'], ['name' => 'Project 4', 'server_id' => $arrangedServer->id, 'stage' => 'staging'], ['name' => 'Project 5', 'server_id' => $arrangedServer->id, 'stage' => 'staging']]);
     $projectRepository = new EloquentProject(new App\Models\Project(), new App\Models\MaxDeployment());
     $foundProjects = $projectRepository->byPage();
     $this->assertCount(5, $foundProjects->items());
 }