Skip to content

Commit 0caafee

Browse files
committed
Lint fix
1 parent b6963bc commit 0caafee

File tree

7 files changed

+85
-89
lines changed

7 files changed

+85
-89
lines changed

src/Meta/ModelMetaData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function parseHighlights($data = []): ?object
9898
return null;
9999
}
100100

101-
public function asArray() : array
101+
public function asArray(): array
102102
{
103103
return [
104104
'score' => $this->score,

tests/Eloquent/ElasticsearchSpecificTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
declare(strict_types=1);
44

5-
use PDPhilip\Elasticsearch\Collection\ElasticCollection;
6-
use Workbench\App\Models\Product;
5+
use PDPhilip\Elasticsearch\Collection\ElasticCollection;
6+
use Workbench\App\Models\Product;
77

88
test('filter products within a geo box', function () {
99

@@ -105,9 +105,9 @@
105105
});
106106

107107
test('execute raw DSL query on products', function () {
108-
Product::factory()->state(['color' => 'silver'])->create();
109-
Product::factory(2)->state(['color' => 'silver'])->create();
110-
Product::factory(1)->state(['color' => 'blue'])->create();
108+
Product::factory()->state(['color' => 'silver'])->create();
109+
Product::factory(2)->state(['color' => 'silver'])->create();
110+
Product::factory(1)->state(['color' => 'blue'])->create();
111111

112112
$bodyParams = [
113113
'query' => [
@@ -119,10 +119,10 @@
119119
$products = Product::rawSearch($bodyParams);
120120

121121
expect($products)
122-
->toBeInstanceOf(ElasticCollection::class)
123-
->toHaveCount(2)
124-
->and($products->first())->toBeInstanceOf(Product::class)
125-
->and($products->first()['color'])->toBe('silver');
122+
->toBeInstanceOf(ElasticCollection::class)
123+
->toHaveCount(2)
124+
->and($products->first())->toBeInstanceOf(Product::class)
125+
->and($products->first()['color'])->toBe('silver');
126126
});
127127

128128
test('perform raw aggregation query', function () {
Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types=1);
44

5-
use Workbench\App\Models\Avatar;
6-
use Workbench\App\Models\Company;
7-
use Workbench\App\Models\CompanyLog;
8-
use Workbench\App\Models\CompanyProfile;
9-
use Workbench\App\Models\Photo;
5+
use Workbench\App\Models\Avatar;
6+
use Workbench\App\Models\Company;
7+
use Workbench\App\Models\CompanyLog;
8+
use Workbench\App\Models\CompanyProfile;
9+
use Workbench\App\Models\Photo;
1010

11-
beforeEach(function () {
11+
beforeEach(function () {
1212
Company::truncate();
1313
CompanyLog::truncate();
1414
CompanyProfile::truncate();
1515
Avatar::truncate();
1616
Photo::truncate();
1717

18-
});
18+
});
1919

20-
it('should show company relationships', function () {
20+
it('should show company relationships', function () {
2121
$logsPerCompany = 10;
2222
$photosPerCompany = 5;
2323

2424
createCompanyData(
25-
photosPerCompany: $photosPerCompany,
26-
logsPerCompany: $logsPerCompany,
25+
photosPerCompany: $photosPerCompany,
26+
logsPerCompany: $logsPerCompany,
2727
);
2828

2929
$company = Company::first();
3030

3131
expect($company->companyLogs)->not()->toBeEmpty()
32-
->and(count($company->companyLogs))->toBe($logsPerCompany)
33-
->and($company->companyProfile->_id)->not()->toBeEmpty()
34-
->and($company->avatar->_id)->not()->toBeEmpty()
35-
->and($company->photos)->not()->toBeEmpty()
36-
->and(count($company->photos))->toBe($photosPerCompany);
32+
->and(count($company->companyLogs))->toBe($logsPerCompany)
33+
->and($company->companyProfile->_id)->not()->toBeEmpty()
34+
->and($company->avatar->_id)->not()->toBeEmpty()
35+
->and($company->photos)->not()->toBeEmpty()
36+
->and(count($company->photos))->toBe($photosPerCompany);
3737

38+
});
3839

39-
});
40-
41-
it('should show user log (ES) relationship to user', function () {
40+
it('should show user log (ES) relationship to user', function () {
4241
createCompanyData();
4342

4443
$companyLog = CompanyLog::first();
4544
expect($companyLog->company->_id)->not()->toBeEmpty()
46-
->and($companyLog->company->companyProfile->_id)->not()->toBeEmpty();
45+
->and($companyLog->company->companyProfile->_id)->not()->toBeEmpty();
4746

48-
});
47+
});
4948

50-
it('should show 1 to 1 ES relationships for user and company', function () {
49+
it('should show 1 to 1 ES relationships for user and company', function () {
5150
createCompanyData();
5251
$companyProfile = CompanyProfile::first();
5352
expect($companyProfile->company->_id)->not()->toBeEmpty();
5453

55-
});
54+
});
Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,62 @@
11
<?php
22

3-
declare(strict_types=1);
3+
declare(strict_types=1);
44

5-
use Workbench\App\Models\Avatar;
6-
use Workbench\App\Models\Company;
7-
use Workbench\App\Models\CompanyProfile;
8-
use Workbench\App\Models\Photo;
9-
use Workbench\App\Models\User;
10-
use Workbench\App\Models\UserLog;
11-
use Workbench\App\Models\UserProfile;
5+
use Workbench\App\Models\Avatar;
6+
use Workbench\App\Models\Company;
7+
use Workbench\App\Models\CompanyProfile;
8+
use Workbench\App\Models\Photo;
9+
use Workbench\App\Models\User;
10+
use Workbench\App\Models\UserLog;
11+
use Workbench\App\Models\UserProfile;
1212

13-
beforeEach(function () {
13+
beforeEach(function () {
1414
User::truncate();
1515
Company::truncate();
1616
UserLog::truncate();
1717
UserProfile::truncate();
1818
CompanyProfile::truncate();
1919
Avatar::truncate();
2020
Photo::truncate();
21-
});
21+
});
2222

23-
it('should show user relationships to ES models', function () {
23+
it('should show user relationships to ES models', function () {
2424

2525
$usersPerCompany = 3;
2626
$logsPerUser = 10;
2727
$photosPerUser = 5;
2828
$photosPerCompany = 2;
2929

3030
createCompanyData(
31-
photosPerCompany: $photosPerCompany,
32-
usersPerCompany : $usersPerCompany,
33-
photosPerUser : $photosPerUser,
34-
logsPerUser : $logsPerUser
31+
photosPerCompany: $photosPerCompany,
32+
usersPerCompany : $usersPerCompany,
33+
photosPerUser : $photosPerUser,
34+
logsPerUser : $logsPerUser
3535
);
3636
$user = User::first();
3737

3838
expect($user->company->_id)->not()->toBeEmpty()
39-
->and($user->company->avatar->_id)->not()->toBeEmpty()
40-
->and($user->photos)->not()->toBeEmpty()
41-
->and(count($user->photos))->toBe($photosPerUser)
42-
->and($user->userLogs)->not()->toBeEmpty()
43-
->and(count($user->userLogs))->toBe($logsPerUser)
44-
->and($user->userProfile->_id)->not()->toBeEmpty()
45-
->and($user->avatar->_id)->not()->toBeEmpty();
39+
->and($user->company->avatar->_id)->not()->toBeEmpty()
40+
->and($user->photos)->not()->toBeEmpty()
41+
->and(count($user->photos))->toBe($photosPerUser)
42+
->and($user->userLogs)->not()->toBeEmpty()
43+
->and(count($user->userLogs))->toBe($logsPerUser)
44+
->and($user->userProfile->_id)->not()->toBeEmpty()
45+
->and($user->avatar->_id)->not()->toBeEmpty();
4646

47-
});
47+
});
4848

49-
50-
it('should show user log (ES) relationship to user', function () {
49+
it('should show user log (ES) relationship to user', function () {
5150
$usersPerCompany = 3;
5251
$logsPerUser = 10;
5352
$photosPerUser = 5;
5453
$photosPerCompany = 2;
5554

5655
createCompanyData(
57-
photosPerCompany: $photosPerCompany,
58-
usersPerCompany : $usersPerCompany,
59-
photosPerUser : $photosPerUser,
60-
logsPerUser : $logsPerUser
56+
photosPerCompany: $photosPerCompany,
57+
usersPerCompany : $usersPerCompany,
58+
photosPerUser : $photosPerUser,
59+
logsPerUser : $logsPerUser
6160
);
6261

6362
$userLog = UserLog::first();
@@ -66,29 +65,28 @@
6665
->and($userLog->user->company->_id)->not()->toBeEmpty()
6766
->and($userLog->user->userProfile->_id)->not()->toBeEmpty()
6867
->and($userLog->company->_id)->not()->toBeEmpty()
69-
->and($userLog->company->users)->toHaveCount($usersPerCompany)
70-
->and($userLog->company->companyProfile->_id)->not()->toBeEmpty();
71-
68+
->and($userLog->company->users)->toHaveCount($usersPerCompany)
69+
->and($userLog->company->companyProfile->_id)->not()->toBeEmpty();
7270

73-
});
71+
});
7472

75-
it('should show 1 to 1 ES relationships for user and company', function () {
73+
it('should show 1 to 1 ES relationships for user and company', function () {
7674
$usersPerCompany = 3;
7775
$logsPerUser = 10;
7876
$photosPerUser = 5;
7977
$photosPerCompany = 2;
8078

8179
createCompanyData(
82-
photosPerCompany: $photosPerCompany,
83-
usersPerCompany : $usersPerCompany,
84-
photosPerUser : $photosPerUser,
85-
logsPerUser : $logsPerUser
80+
photosPerCompany: $photosPerCompany,
81+
usersPerCompany : $usersPerCompany,
82+
photosPerUser : $photosPerUser,
83+
logsPerUser : $logsPerUser
8684
);
8785

8886
$companyProfile = CompanyProfile::first();
8987
$userProfile = UserProfile::first();
9088

9189
expect($companyProfile->company->_id)->not()->toBeEmpty()
92-
->and($userProfile->user->id)->not()->toBeEmpty();
90+
->and($userProfile->user->id)->not()->toBeEmpty();
9391

94-
});
92+
});

workbench/app/Models/HiddenAnimal.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace Workbench\App\Models;
44

5-
use Illuminate\Database\Eloquent\Factories\HasFactory;
65
use PDPhilip\Elasticsearch\Eloquent\Model;
7-
use Workbench\Database\Factories\AvatarFactory;
86

97
/**
108
* @property string $name
@@ -13,14 +11,15 @@
1311
*/
1412
final class HiddenAnimal extends Model
1513
{
16-
protected $connection = 'elasticsearch';
14+
protected $connection = 'elasticsearch';
1715

18-
protected $keyType = 'string';
19-
protected $fillable = [
20-
'name',
21-
'country',
22-
'can_be_eaten',
23-
];
16+
protected $keyType = 'string';
2417

25-
protected $hidden = ['country'];
18+
protected $fillable = [
19+
'name',
20+
'country',
21+
'can_be_eaten',
22+
];
23+
24+
protected $hidden = ['country'];
2625
}

workbench/app/Models/UserLog.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ class UserLog extends Model
4747

4848
protected $connection = 'elasticsearch';
4949

50-
protected $fillable = [
51-
'title',
52-
'code',
53-
'user_id',
54-
];
50+
protected $fillable = [
51+
'title',
52+
'code',
53+
'user_id',
54+
];
5555

5656
public function user()
5757
{

workbench/database/factories/EsPhotoFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class EsPhotoFactory extends Factory
1212
public function definition(): array
1313
{
1414
return [
15-
'url' => fake()->imageUrl()
15+
'url' => fake()->imageUrl(),
1616
];
1717
}
1818
}

0 commit comments

Comments
 (0)