Skip to content

Commit

Permalink
github actions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osbre committed Jun 10, 2020
1 parent e190af6 commit a938ece
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: run-tests

on: [push]

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: MilesChou/composer-action/7.4/install@master
- uses: docker://php:7.4-alpine
with:
args: php vendor/bin/pest
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</whitelist>
</filter>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
Expand Down
3 changes: 2 additions & 1 deletion src/Columns/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class Column
public string $title;

/**
* Model property name, will be used in updates
* Column name, will be used in updates
* @var string
*/
public string $name;
Expand All @@ -46,6 +46,7 @@ public function tdData(array $attributes, object $loop): array
'value' => $attributes[$this->name] ?? '',
'loop' => $loop,
'key' => "rows.{$loop->index}.{$this->name}",
'attributes' => $attributes,
];
}

Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use Ostap\EditableTable\EditableTableServiceProvider;

Expand All @@ -19,6 +20,7 @@ protected function setUp(): void
protected function getPackageProviders($app)
{
return [
LivewireServiceProvider::class,
EditableTableServiceProvider::class,
];
}
Expand Down
5 changes: 4 additions & 1 deletion tests/TestTableComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ostap\EditableTable\Test;

use Illuminate\Database\Eloquent\Builder;
use Ostap\EditableTable\Columns\Text;
use Ostap\EditableTable\EditableTable;

class TestTableComponent extends EditableTable
Expand All @@ -14,6 +15,8 @@ public function query(): Builder

public function columns(): array
{
return [];
return [
Text::make('Name'),
];
}
}
4 changes: 1 addition & 3 deletions tests/Unit/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
uses(TestCase::class);

it('update model', function () {
Livewire::test(TestTableComponent::class)
->set('rows.1.name', 'new value')
->emit('updated');
Livewire::test(TestTableComponent::class)->set('rows.1.name', 'new value');

assert(TestModel::first()->name, 'new value');
});

0 comments on commit a938ece

Please sign in to comment.