Skip to content

Commit 3d6c5d8

Browse files
ManukMinasyanclaude
andcommitted
Add comprehensive feature test suite and fix core API issues
- Add 46 comprehensive Pest tests covering real-world Kanban board functionality - Implement proper Livewire testing patterns for BoardPage components - Add feature tests for drag-and-drop, actions, commands, and service provider - Fix stub template to use correct API (recordTitleAttribute vs cardTitle) - Remove references to missing KanbanBoard Livewire class - Update TestCase with proper Filament panel setup for Livewire testing - Add test fixtures for realistic testing scenarios - Fix PHPStan configuration and code formatting issues - Update CLAUDE.md with testing documentation and correct API patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent cac6c85 commit 3d6c5d8

25 files changed

+830
-111
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ parameters:
1010
tmpDir: build/phpstan
1111
checkOctaneCompatibility: true
1212
checkModelProperties: true
13-
checkMissingIterableValueType: false
1413

src/Board.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ protected function setUp(): void
5353
// Any board-specific setup can go here
5454
}
5555

56-
5756
/**
5857
* Get view data for the board template.
5958
* Delegates to Livewire component like Filament's Table does.
@@ -62,24 +61,29 @@ public function getViewData(): array
6261
{
6362
// Direct delegation to Livewire component (no adapter)
6463
$livewire = $this->getLivewire();
65-
64+
6665
// Create simple config object
67-
$config = new class($this) {
66+
$config = new class($this)
67+
{
6868
public function __construct(private Board $board) {}
69-
70-
public function getTitleField(): string {
69+
70+
public function getTitleField(): string
71+
{
7172
return $this->board->getRecordTitleAttribute();
7273
}
73-
74-
public function getColumnField(): string {
74+
75+
public function getColumnField(): string
76+
{
7577
return $this->board->getColumnIdentifierAttribute() ?? 'status';
7678
}
77-
78-
public function getSingularCardLabel(): string {
79+
80+
public function getSingularCardLabel(): string
81+
{
7982
return 'Card';
8083
}
81-
82-
public function getPluralCardLabel(): string {
84+
85+
public function getPluralCardLabel(): string
86+
{
8387
return 'Cards';
8488
}
8589
};
@@ -88,11 +92,11 @@ public function getPluralCardLabel(): string {
8892
$columns = [];
8993
foreach ($this->getColumns() as $column) {
9094
$columnId = $column->getName();
91-
95+
9296
// Get formatted records
9397
$records = $this->getBoardRecords($columnId);
94-
$formattedRecords = $records->map(fn($record) => $this->formatBoardRecord($record))->toArray();
95-
98+
$formattedRecords = $records->map(fn ($record) => $this->formatBoardRecord($record))->toArray();
99+
96100
$columns[$columnId] = [
97101
'id' => $columnId,
98102
'label' => $column->getLabel(),
@@ -108,7 +112,6 @@ public function getPluralCardLabel(): string {
108112
];
109113
}
110114

111-
112115
protected function resolveDefaultClosureDependencyForEvaluationByName(string $parameterName): array
113116
{
114117
return match ($parameterName) {

src/Board/Concerns/CanSearchBoardRecords.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
trait CanSearchBoardRecords
1313
{
1414
protected array $searchableFields = [];
15+
1516
protected bool $isSearchable = false;
1617

1718
/**
@@ -21,6 +22,7 @@ public function searchable(array | Closure $fields = []): static
2122
{
2223
$this->searchableFields = $this->evaluate($fields);
2324
$this->isSearchable = true;
25+
2426
return $this;
2527
}
2628

@@ -29,7 +31,7 @@ public function searchable(array | Closure $fields = []): static
2931
*/
3032
public function isSearchable(): bool
3133
{
32-
return $this->isSearchable && !empty($this->searchableFields);
34+
return $this->isSearchable && ! empty($this->searchableFields);
3335
}
3436

3537
/**
@@ -39,4 +41,4 @@ public function getSearchableFields(): array
3941
{
4042
return $this->searchableFields;
4143
}
42-
}
44+
}

src/Board/Concerns/HasBoardActions.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ trait HasBoardActions
2929
protected array $columnActions = [];
3030

3131
protected ?string $cardAction = null;
32+
3233
protected array $registeredCardActions = [];
3334

3435
/**
@@ -37,6 +38,7 @@ trait HasBoardActions
3738
public function actions(array | Closure $actions): static
3839
{
3940
$this->actions = $this->evaluate($actions);
41+
4042
return $this;
4143
}
4244

@@ -46,6 +48,7 @@ public function actions(array | Closure $actions): static
4648
public function recordActions(array | Closure $actions): static
4749
{
4850
$this->recordActions = $this->evaluate($actions);
51+
4952
return $this;
5053
}
5154

@@ -55,6 +58,7 @@ public function recordActions(array | Closure $actions): static
5558
public function columnActions(array | Closure $actions): static
5659
{
5760
$this->columnActions = $this->evaluate($actions);
61+
5862
return $this;
5963
}
6064

@@ -64,6 +68,7 @@ public function columnActions(array | Closure $actions): static
6468
public function cardAction(string | Closure | null $action): static
6569
{
6670
$this->cardAction = $this->evaluate($action);
71+
6772
return $this;
6873
}
6974

@@ -129,7 +134,7 @@ public function getRegisteredCardAction(string $name): ?Action
129134
public function getBoardRecordActions(array $record): array
130135
{
131136
$livewire = $this->getLivewire();
132-
137+
133138
if (method_exists($livewire, 'getBoardRecordActions')) {
134139
return $livewire->getBoardRecordActions($record);
135140
}
@@ -144,12 +149,12 @@ public function getBoardRecordActions(array $record): array
144149
public function getBoardColumnActions(string $columnId): array
145150
{
146151
$livewire = $this->getLivewire();
147-
152+
148153
if (method_exists($livewire, 'getBoardColumnActions')) {
149154
return $livewire->getBoardColumnActions($columnId);
150155
}
151156

152157
// Fallback: return raw actions
153158
return $this->getColumnActions();
154159
}
155-
}
160+
}

src/Board/Concerns/HasBoardColumns.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getColumnIdentifiers(): array
6969
public function getColumnLabels(): array
7070
{
7171
$labels = [];
72-
72+
7373
foreach ($this->columns as $column) {
7474
$labels[$column->getName()] = $column->getLabel() ?? $column->getName();
7575
}
@@ -83,7 +83,7 @@ public function getColumnLabels(): array
8383
public function getColumnColors(): array
8484
{
8585
$colors = [];
86-
86+
8787
foreach ($this->columns as $column) {
8888
if ($color = $column->getColor()) {
8989
$colors[$column->getName()] = $color;
@@ -92,4 +92,4 @@ public function getColumnColors(): array
9292

9393
return $colors;
9494
}
95-
}
95+
}

src/Board/Concerns/HasBoardRecords.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ public function formatBoardRecord(Model $record): array
118118
// Process card schema if available
119119
if (method_exists($this, 'getCardSchema')) {
120120
$schema = $this->getCardSchema();
121-
121+
122122
if ($schema !== null) {
123123
// The schema is already built and configured
124124
$schema->model($record);
125-
125+
126126
// Render the entire schema as HTML
127127
$formatted['schema_html'] = $schema->toHtml();
128128
}

src/BoardPage.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Filament\Forms\Concerns\InteractsWithForms;
1010
use Filament\Forms\Contracts\HasForms;
1111
use Filament\Pages\Page;
12-
use Illuminate\Database\Eloquent\Builder;
1312
use Relaticle\Flowforge\Concerns\InteractsWithBoard;
1413
use Relaticle\Flowforge\Contracts\HasBoard;
1514

src/Components/CardFlex.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ class CardFlex extends Component
1818
protected string $view = 'flowforge::components.card-flex';
1919

2020
protected string $gap = 'xs';
21+
2122
protected bool $wrap = true;
23+
2224
protected string $justify = 'start';
25+
2326
protected string $align = 'center';
2427

2528
/**
@@ -47,6 +50,7 @@ public static function make(array | Closure $schema): static
4750
public function wrap(bool $wrap = true): static
4851
{
4952
$this->wrap = $wrap;
53+
5054
return $this;
5155
}
5256

@@ -56,6 +60,7 @@ public function wrap(bool $wrap = true): static
5660
public function justify(string $justify): static
5761
{
5862
$this->justify = $justify;
63+
5964
return $this;
6065
}
6166

@@ -65,6 +70,7 @@ public function justify(string $justify): static
6570
public function align(string $align): static
6671
{
6772
$this->align = $align;
73+
6874
return $this;
6975
}
7076

src/Concerns/HasCardSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getCardSchema(): ?Schema
3232

3333
$livewire = $this->getLivewire();
3434
$schema = Schema::make($livewire);
35-
35+
3636
return $this->evaluate($this->cardSchemaBuilder, ['schema' => $schema]);
3737
}
3838

src/Concerns/InteractsWithKanbanQuery.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@
1010
trait InteractsWithKanbanQuery
1111
{
1212
protected Builder | Closure | null $query = null;
13+
1314
protected string | Closure | null $columnIdentifierAttribute = null;
15+
1416
protected array | Closure | null $reorderBy = null;
1517

1618
public function query(Builder | Closure $query): static
1719
{
1820
$this->query = $query;
21+
1922
return $this;
2023
}
2124

2225
public function columnIdentifier(string | Closure $attribute): static
2326
{
2427
$this->columnIdentifierAttribute = $attribute;
28+
2529
return $this;
2630
}
2731

@@ -31,6 +35,7 @@ public function reorderBy(string $column, string $direction = 'asc'): static
3135
'column' => $column,
3236
'direction' => $direction,
3337
];
38+
3439
return $this;
3540
}
3641

0 commit comments

Comments
 (0)