1
1
<?php
2
2
3
- use Tests \ Feature \ TestUserResource ;
3
+ use Kirschbaum \ Loop \ Filament \ DescribeFilamentResourceTool ;
4
4
use Tests \Feature \TestPostWithRelationsResource ;
5
+ use Tests \Feature \TestUserResource ;
5
6
use Tests \Feature \TestUserWithRelationsResource ;
6
- use Kirschbaum \Loop \Filament \DescribeFilamentResourceTool ;
7
7
8
8
it ('can instantiate the describe filament resource tool ' , function () {
9
- $ tool = new DescribeFilamentResourceTool () ;
9
+ $ tool = new DescribeFilamentResourceTool ;
10
10
11
11
expect ($ tool )->toBeInstanceOf (DescribeFilamentResourceTool::class);
12
12
expect ($ tool ->getName ())->toBe ('describe_filament_resource ' );
13
13
});
14
14
15
15
it ('can extract table schema using the tool ' , function () {
16
- $ tool = new DescribeFilamentResourceTool () ;
16
+ $ tool = new DescribeFilamentResourceTool ;
17
17
$ resource = app (TestUserResource::class);
18
18
19
19
$ tableSchema = $ tool ->extractTableSchema ($ resource );
28
28
});
29
29
30
30
it ('can extract column properties through the tool ' , function () {
31
- $ tool = new DescribeFilamentResourceTool () ;
31
+ $ tool = new DescribeFilamentResourceTool ;
32
32
$ resource = app (TestUserResource::class);
33
33
34
34
$ tableSchema = $ tool ->extractTableSchema ($ resource );
46
46
});
47
47
48
48
it ('can extract bulk actions through the tool ' , function () {
49
- $ tool = new DescribeFilamentResourceTool () ;
49
+ $ tool = new DescribeFilamentResourceTool ;
50
50
$ resource = app (TestUserResource::class);
51
51
52
52
$ tableSchema = $ tool ->extractTableSchema ($ resource );
57
57
});
58
58
59
59
it ('can extract resource relationships through the tool ' , function () {
60
- $ tool = new DescribeFilamentResourceTool () ;
60
+ $ tool = new DescribeFilamentResourceTool ;
61
61
$ resource = app (TestUserWithRelationsResource::class);
62
62
63
63
$ relationships = $ tool ->extractRelationshipsInfo ($ resource );
75
75
});
76
76
77
77
it ('can describe a complete resource using the tool ' , function () {
78
- $ tool = new DescribeFilamentResourceTool () ;
78
+ $ tool = new DescribeFilamentResourceTool ;
79
79
80
80
$ result = $ tool ->describe (TestUserWithRelationsResource::class);
81
81
95
95
});
96
96
97
97
it ('can extract different relationship types including belongsTo ' , function () {
98
- $ tool = new DescribeFilamentResourceTool () ;
98
+ $ tool = new DescribeFilamentResourceTool ;
99
99
$ resource = app (TestPostWithRelationsResource::class);
100
100
101
101
$ relationships = $ tool ->extractRelationshipsInfo ($ resource );
113
113
});
114
114
115
115
it ('can describe a resource with mixed relationship types ' , function () {
116
- $ tool = new DescribeFilamentResourceTool () ;
116
+ $ tool = new DescribeFilamentResourceTool ;
117
117
118
118
$ result = $ tool ->describe (TestPostWithRelationsResource::class);
119
119
127
127
expect ($ relationships )->toHaveKeys (['comments ' , 'category ' ])
128
128
->and ($ relationships ['comments ' ]['type ' ])->toBe ('HasMany ' )
129
129
->and ($ relationships ['category ' ]['type ' ])->toBe ('BelongsTo ' );
130
- });
130
+ });
0 commit comments