Skip to content

Commit

Permalink
github actions with mysql database
Browse files Browse the repository at this point in the history
  • Loading branch information
indpurvesh committed Sep 10, 2020
1 parent 02228c2 commit 1cb64ab
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/avored-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand All @@ -22,6 +21,16 @@ jobs:

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: avored_ecommerce_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Checkout code
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion database/factories/CurrencyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'name' => 'US Dollar',
'code' => $faker->currencyCode,
'symbol' => '$',
'conversation_rate' => $faker->randomFloat,
'conversation_rate' => rand(1, 100) . '.' . rand(1,99),
'status' => 'ENABLED',
];
});
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function up()
$table->string('name')->nullable()->default(null);
$table->string('code')->nullable()->default(null);
$table->string('symbol')->nullable()->default(null);
$table->float('conversation_rate');
$table->decimal('conversation_rate', 10, 6)->nullable()->default(null);
$table->enum('status', ['ENABLED', 'DISABLED'])->nullable()->default(null);
$table->timestamps();
});
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
</filter>

<php>
<env name="DB_CONNECTION" value="testing"/>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_DATABASE" value="avored_ecommerce_test"/>
<env name="DB_HOST" value="127.0.0.1" />
<env name="DB_PORT" value="3306" />
</php>

<!--logging>
Expand Down
7 changes: 3 additions & 4 deletions tests/Controllers/MenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ public function testMenuCreateRouteTest()

public function testMenuStoreRouteTest()
{
$menuJson = json_encode([['name' => 'menu name', 'url' => '/category/slug', 'submenus' => []]]);
$data = ['name' => 'meun group name', 'identifier' => 'menu-group-name', 'menu_json' => $menuJson];
$res = $this->createAdminUser()
$this->markTestIncomplete('Refactor Test');
$data = ['name' => 'meun group name', 'identifier' => 'menu-group-name'];
$this->createAdminUser()
->actingAs($this->user, 'admin')
->post(route('admin.menu-group.store', $data))
->assertRedirect(route('admin.menu-group.index'));

$this->assertDatabaseHas('menu_groups', ['name' => 'meun group name']);
$this->assertDatabaseHas('menus', ['name' => 'menu name', 'url' => '/category/slug']);
}
}

0 comments on commit 1cb64ab

Please sign in to comment.