@@ -8,76 +8,76 @@ |
||
| 8 | 8 | {
|
| 9 | 9 | |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @group Modules |
|
| 13 | - * @group config |
|
| 14 | - */ |
|
| 15 | - public function testAllTheModulesGot11Players() |
|
| 16 | - {
|
|
| 17 | - $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 18 | - $this->assertNotEmpty($modules); |
|
| 19 | - foreach ($modules as $key => $module) {
|
|
| 20 | - $this->assertNotEmpty($module["roles"]); |
|
| 21 | - $count = 0; |
|
| 22 | - foreach ($module["roles"] as $roleNum) {
|
|
| 23 | - $count += $roleNum; |
|
| 24 | - } |
|
| 25 | - $this->assertTrue(11 === $count, "Not correct Players for $key"); |
|
| 26 | - } |
|
| 27 | - } |
|
| 11 | + /** |
|
| 12 | + * @group Modules |
|
| 13 | + * @group config |
|
| 14 | + */ |
|
| 15 | + public function testAllTheModulesGot11Players() |
|
| 16 | + {
|
|
| 17 | + $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 18 | + $this->assertNotEmpty($modules); |
|
| 19 | + foreach ($modules as $key => $module) {
|
|
| 20 | + $this->assertNotEmpty($module["roles"]); |
|
| 21 | + $count = 0; |
|
| 22 | + foreach ($module["roles"] as $roleNum) {
|
|
| 23 | + $count += $roleNum; |
|
| 24 | + } |
|
| 25 | + $this->assertTrue(11 === $count, "Not correct Players for $key"); |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @group Roles |
|
| 31 | - * @group config |
|
| 32 | - */ |
|
| 33 | - public function testCorrectDisplayModuleDescriptionRole() |
|
| 34 | - {
|
|
| 35 | - $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 36 | - $this->assertNotEmpty($modules); |
|
| 37 | - $roles = \App\Lib\Helpers\Config::get('modules.roles');
|
|
| 38 | - $rolesKeys = array_keys($roles); |
|
| 29 | + /** |
|
| 30 | + * @group Roles |
|
| 31 | + * @group config |
|
| 32 | + */ |
|
| 33 | + public function testCorrectDisplayModuleDescriptionRole() |
|
| 34 | + {
|
|
| 35 | + $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 36 | + $this->assertNotEmpty($modules); |
|
| 37 | + $roles = \App\Lib\Helpers\Config::get('modules.roles');
|
|
| 38 | + $rolesKeys = array_keys($roles); |
|
| 39 | 39 | |
| 40 | - foreach ($modules as $key => $module) {
|
|
| 41 | - $this->assertNotEmpty($module["roles"]); |
|
| 42 | - foreach ($module["roles"] as $index => $playNum) {
|
|
| 43 | - if ($playNum != 0) {
|
|
| 44 | - $this->assertGreaterThan(0, $playNum); |
|
| 45 | - $this->assertNotNull($roles[$rolesKeys[$index]]["description"]); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - } |
|
| 40 | + foreach ($modules as $key => $module) {
|
|
| 41 | + $this->assertNotEmpty($module["roles"]); |
|
| 42 | + foreach ($module["roles"] as $index => $playNum) {
|
|
| 43 | + if ($playNum != 0) {
|
|
| 44 | + $this->assertGreaterThan(0, $playNum); |
|
| 45 | + $this->assertNotNull($roles[$rolesKeys[$index]]["description"]); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @group rand |
|
| 53 | - * |
|
| 54 | - */ |
|
| 55 | - public function testRandomizer() |
|
| 56 | - {
|
|
| 57 | - $yes = 0; |
|
| 58 | - $no = 0; |
|
| 59 | - for ($i = 1; $i <= 100; $i++) {
|
|
| 60 | - if (\App\Lib\DsManager\Helpers\Randomizer::boolOnPercentage(20)) {
|
|
| 61 | - $yes++; |
|
| 62 | - } else {
|
|
| 63 | - $no++; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - $this->assertNotEmpty($yes); |
|
| 67 | - $this->assertNotEmpty($no); |
|
| 68 | - $this->assertGreaterThan($yes, $no); |
|
| 69 | - } |
|
| 51 | + /** |
|
| 52 | + * @group rand |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | + public function testRandomizer() |
|
| 56 | + {
|
|
| 57 | + $yes = 0; |
|
| 58 | + $no = 0; |
|
| 59 | + for ($i = 1; $i <= 100; $i++) {
|
|
| 60 | + if (\App\Lib\DsManager\Helpers\Randomizer::boolOnPercentage(20)) {
|
|
| 61 | + $yes++; |
|
| 62 | + } else {
|
|
| 63 | + $no++; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + $this->assertNotEmpty($yes); |
|
| 67 | + $this->assertNotEmpty($no); |
|
| 68 | + $this->assertGreaterThan($yes, $no); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @group randFiller |
|
| 73 | - * |
|
| 74 | - */ |
|
| 75 | - public function testRandomFiller() |
|
| 76 | - {
|
|
| 77 | - $rndF = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 78 | - for ($i = 1; $i <= 10; $i++) {
|
|
| 79 | - $this->assertNotEmpty($rndF->getLocale()); |
|
| 80 | - } |
|
| 81 | - } |
|
| 71 | + /** |
|
| 72 | + * @group randFiller |
|
| 73 | + * |
|
| 74 | + */ |
|
| 75 | + public function testRandomFiller() |
|
| 76 | + {
|
|
| 77 | + $rndF = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 78 | + for ($i = 1; $i <= 10; $i++) {
|
|
| 79 | + $this->assertNotEmpty($rndF->getLocale()); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | } |
@@ -3,20 +3,20 @@ |
||
| 3 | 3 | |
| 4 | 4 | class ATeamsSeeder |
| 5 | 5 | { |
| 6 | - function run() |
|
| 7 | - { |
|
| 8 | - $teamNumber = 10; |
|
| 9 | - $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 10 | - for ($i = 1; $i <= $teamNumber; $i++) { |
|
| 11 | - $team = $rndFiller->getTeam($rndFiller->getLocale()); |
|
| 12 | - $teamArray = $team->toArray(); |
|
| 13 | - $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray); |
|
| 14 | - foreach ($teamArray['roster'] as $player) { |
|
| 15 | - $player['team_id'] = $teamO->id; |
|
| 16 | - \App\Lib\DsManager\Models\Orm\Player::create($player); |
|
| 17 | - } |
|
| 18 | - $teamArray['coach']['team_id'] = $teamO->id; |
|
| 19 | - \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']); |
|
| 20 | - } |
|
| 21 | - } |
|
| 6 | + function run() |
|
| 7 | + { |
|
| 8 | + $teamNumber = 10; |
|
| 9 | + $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 10 | + for ($i = 1; $i <= $teamNumber; $i++) { |
|
| 11 | + $team = $rndFiller->getTeam($rndFiller->getLocale()); |
|
| 12 | + $teamArray = $team->toArray(); |
|
| 13 | + $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray); |
|
| 14 | + foreach ($teamArray['roster'] as $player) { |
|
| 15 | + $player['team_id'] = $teamO->id; |
|
| 16 | + \App\Lib\DsManager\Models\Orm\Player::create($player); |
|
| 17 | + } |
|
| 18 | + $teamArray['coach']['team_id'] = $teamO->id; |
|
| 19 | + \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']); |
|
| 20 | + } |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -5,19 +5,19 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateTeamTable |
| 7 | 7 | {
|
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - {
|
|
| 15 | - Capsule::schema()->dropIfExists('teams');
|
|
| 16 | - Capsule::schema()->create('teams', function (Blueprint $table) {
|
|
| 17 | - $table->increments('id');
|
|
| 18 | - $table->string('name');
|
|
| 19 | - $table->string('nationality',2);
|
|
| 20 | - $table->timestamps(); |
|
| 21 | - }); |
|
| 22 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + {
|
|
| 15 | + Capsule::schema()->dropIfExists('teams');
|
|
| 16 | + Capsule::schema()->create('teams', function (Blueprint $table) {
|
|
| 17 | + $table->increments('id');
|
|
| 18 | + $table->string('name');
|
|
| 19 | + $table->string('nationality',2);
|
|
| 20 | + $table->timestamps(); |
|
| 21 | + }); |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -13,10 +13,10 @@ |
||
| 13 | 13 | public function run() |
| 14 | 14 | {
|
| 15 | 15 | Capsule::schema()->dropIfExists('teams');
|
| 16 | - Capsule::schema()->create('teams', function (Blueprint $table) {
|
|
| 16 | + Capsule::schema()->create('teams', function(Blueprint $table) {
|
|
| 17 | 17 | $table->increments('id');
|
| 18 | 18 | $table->string('name');
|
| 19 | - $table->string('nationality',2);
|
|
| 19 | + $table->string('nationality', 2);
|
|
| 20 | 20 | $table->timestamps(); |
| 21 | 21 | }); |
| 22 | 22 | } |
@@ -5,35 +5,35 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateCoachesTable |
| 7 | 7 | {
|
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - {
|
|
| 15 | - Capsule::schema()->dropIfExists('coaches');
|
|
| 16 | - Capsule::schema()->create('coaches', function (Blueprint $table) {
|
|
| 17 | - $table->increments('id');
|
|
| 18 | - $table->string('name');
|
|
| 19 | - $table->string('surname');
|
|
| 20 | - $table->tinyInteger('age');
|
|
| 21 | - $table->string('nationality',2);
|
|
| 22 | - $table->float('skillAvg');
|
|
| 23 | - $table->float('wageReq');
|
|
| 24 | - $table->string('favouriteModule',10);
|
|
| 25 | - $table->integer('team_id')->nullable();
|
|
| 26 | - $table->timestamps(); |
|
| 27 | - }); |
|
| 28 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + {
|
|
| 15 | + Capsule::schema()->dropIfExists('coaches');
|
|
| 16 | + Capsule::schema()->create('coaches', function (Blueprint $table) {
|
|
| 17 | + $table->increments('id');
|
|
| 18 | + $table->string('name');
|
|
| 19 | + $table->string('surname');
|
|
| 20 | + $table->tinyInteger('age');
|
|
| 21 | + $table->string('nationality',2);
|
|
| 22 | + $table->float('skillAvg');
|
|
| 23 | + $table->float('wageReq');
|
|
| 24 | + $table->string('favouriteModule',10);
|
|
| 25 | + $table->integer('team_id')->nullable();
|
|
| 26 | + $table->timestamps(); |
|
| 27 | + }); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Reverse the migrations. |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function down() |
|
| 36 | - {
|
|
| 37 | - Schema::drop('coaches');
|
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Reverse the migrations. |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function down() |
|
| 36 | + {
|
|
| 37 | + Schema::drop('coaches');
|
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -13,15 +13,15 @@ |
||
| 13 | 13 | public function run() |
| 14 | 14 | {
|
| 15 | 15 | Capsule::schema()->dropIfExists('coaches');
|
| 16 | - Capsule::schema()->create('coaches', function (Blueprint $table) {
|
|
| 16 | + Capsule::schema()->create('coaches', function(Blueprint $table) {
|
|
| 17 | 17 | $table->increments('id');
|
| 18 | 18 | $table->string('name');
|
| 19 | 19 | $table->string('surname');
|
| 20 | 20 | $table->tinyInteger('age');
|
| 21 | - $table->string('nationality',2);
|
|
| 21 | + $table->string('nationality', 2);
|
|
| 22 | 22 | $table->float('skillAvg');
|
| 23 | 23 | $table->float('wageReq');
|
| 24 | - $table->string('favouriteModule',10);
|
|
| 24 | + $table->string('favouriteModule', 10);
|
|
| 25 | 25 | $table->integer('team_id')->nullable();
|
| 26 | 26 | $table->timestamps(); |
| 27 | 27 | }); |
@@ -5,26 +5,26 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreatePlayersTable |
| 7 | 7 | {
|
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - {
|
|
| 15 | - Capsule::schema()->dropIfExists('players');
|
|
| 16 | - Capsule::schema()->create('players', function (Blueprint $table) {
|
|
| 17 | - $table->increments('id');
|
|
| 18 | - $table->string('name');
|
|
| 19 | - $table->string('surname');
|
|
| 20 | - $table->tinyInteger('age');
|
|
| 21 | - $table->string('nationality',2);
|
|
| 22 | - $table->float('skillAvg');
|
|
| 23 | - $table->float('wageReq');
|
|
| 24 | - $table->float('val');
|
|
| 25 | - $table->string('role',2);
|
|
| 26 | - $table->integer('team_id')->nullable();
|
|
| 27 | - $table->timestamps(); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + {
|
|
| 15 | + Capsule::schema()->dropIfExists('players');
|
|
| 16 | + Capsule::schema()->create('players', function (Blueprint $table) {
|
|
| 17 | + $table->increments('id');
|
|
| 18 | + $table->string('name');
|
|
| 19 | + $table->string('surname');
|
|
| 20 | + $table->tinyInteger('age');
|
|
| 21 | + $table->string('nationality',2);
|
|
| 22 | + $table->float('skillAvg');
|
|
| 23 | + $table->float('wageReq');
|
|
| 24 | + $table->float('val');
|
|
| 25 | + $table->string('role',2);
|
|
| 26 | + $table->integer('team_id')->nullable();
|
|
| 27 | + $table->timestamps(); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -13,16 +13,16 @@ |
||
| 13 | 13 | public function run() |
| 14 | 14 | {
|
| 15 | 15 | Capsule::schema()->dropIfExists('players');
|
| 16 | - Capsule::schema()->create('players', function (Blueprint $table) {
|
|
| 16 | + Capsule::schema()->create('players', function(Blueprint $table) {
|
|
| 17 | 17 | $table->increments('id');
|
| 18 | 18 | $table->string('name');
|
| 19 | 19 | $table->string('surname');
|
| 20 | 20 | $table->tinyInteger('age');
|
| 21 | - $table->string('nationality',2);
|
|
| 21 | + $table->string('nationality', 2);
|
|
| 22 | 22 | $table->float('skillAvg');
|
| 23 | 23 | $table->float('wageReq');
|
| 24 | 24 | $table->float('val');
|
| 25 | - $table->string('role',2);
|
|
| 25 | + $table->string('role', 2);
|
|
| 26 | 26 | $table->integer('team_id')->nullable();
|
| 27 | 27 | $table->timestamps(); |
| 28 | 28 | }); |
@@ -10,14 +10,14 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | $capsule = new Capsule; |
| 12 | 12 | $capsule->addConnection(array( |
| 13 | - 'driver' => 'mysql', |
|
| 14 | - 'host' => 'localhost', |
|
| 15 | - 'database' => 'dsmanager', |
|
| 16 | - 'username' => empty(getenv('USERNAME')) ? 'root' : getenv('USERNAME'),
|
|
| 17 | - 'password' => empty(getenv('PASSWORD')) ? '' : getenv('PASSWORD'),
|
|
| 18 | - 'charset' => 'utf8', |
|
| 19 | - 'collation' => 'utf8_general_ci', |
|
| 20 | - 'prefix' => '' |
|
| 13 | + 'driver' => 'mysql', |
|
| 14 | + 'host' => 'localhost', |
|
| 15 | + 'database' => 'dsmanager', |
|
| 16 | + 'username' => empty(getenv('USERNAME')) ? 'root' : getenv('USERNAME'),
|
|
| 17 | + 'password' => empty(getenv('PASSWORD')) ? '' : getenv('PASSWORD'),
|
|
| 18 | + 'charset' => 'utf8', |
|
| 19 | + 'collation' => 'utf8_general_ci', |
|
| 20 | + 'prefix' => '' |
|
| 21 | 21 | )); |
| 22 | 22 | $capsule->setAsGlobal(); |
| 23 | 23 | $capsule->bootEloquent(); |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Database\Capsule\Manager as Capsule; |
| 4 | 4 | |
| 5 | -$dotenv = new Dotenv\Dotenv(__DIR__ . "/../"); |
|
| 5 | +$dotenv = new Dotenv\Dotenv(__DIR__."/../"); |
|
| 6 | 6 | $dotenv->load(); |
| 7 | 7 | |
| 8 | 8 | /** |