Skip to content

Commit 3152b59

Browse files
limenetactions-user
authored andcommitted
Fix styling
1 parent 6cd6beb commit 3152b59

File tree

8 files changed

+46
-41
lines changed

8 files changed

+46
-41
lines changed

src/Model/ElasticsearchableTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ final public function getElasticsearchId(): string
1818
{
1919
return $this::class.'|'.$this->id;
2020
}
21-
public function toElasticsearch(IndexInterface $indexConfig): array{
21+
public function toElasticsearch(IndexInterface $indexConfig): array
22+
{
2223
return $this->toArray();
2324
}
2425

tests/App/Elasticsearch/CustomerIndex.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,26 @@
66
use Limenet\LaravelElasticaBridge\Index\AbstractIndex;
77
use Limenet\LaravelElasticaBridge\Tests\App\Models\Customer;
88

9-
class CustomerIndex extends AbstractIndex {
9+
class CustomerIndex extends AbstractIndex
10+
{
11+
public function getName(): string
12+
{
13+
return 'testing_customer';
14+
}
1015

11-
public function getName(): string { return 'testing_customer'; }
12-
13-
public function getAllowedDocuments(): array {
16+
public function getAllowedDocuments(): array
17+
{
1418
return [Customer::class];
15-
}
19+
}
1620

17-
public function getMapping(): array
18-
{
19-
return [
21+
public function getMapping(): array
22+
{
23+
return [
2024
'properties' => [
2125
'group' => [
2226
'type' => 'keyword',
2327
],
24-
]
28+
],
2529
];
26-
}
30+
}
2731
}

tests/App/Models/Customer.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@
1010
use Limenet\LaravelElasticaBridge\Model\ElasticsearchableTrait;
1111
use Limenet\LaravelElasticaBridge\Tests\Database\Factories\CustomerFactory;
1212

13-
class Customer extends Model implements ElasticsearchableInterface{
14-
use HasFactory;
15-
use ElasticsearchableTrait;
13+
class Customer extends Model implements ElasticsearchableInterface
14+
{
15+
use HasFactory;
16+
use ElasticsearchableTrait;
1617

17-
public function toElasticsearch(IndexInterface $indexConfig): array { return $this->toArray(); }
18+
public function toElasticsearch(IndexInterface $indexConfig): array
19+
{
20+
return $this->toArray();
21+
}
1822

19-
public function shouldIndex(IndexInterface $indexConfig): bool { return true;}
20-
protected static function newFactory():Factory
21-
{
22-
return CustomerFactory::new();
23-
}
23+
public function shouldIndex(IndexInterface $indexConfig): bool
24+
{
25+
return true;
26+
}
27+
protected static function newFactory():Factory
28+
{
29+
return CustomerFactory::new();
30+
}
2431
}

tests/IndexTest.php

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

33
namespace Limenet\LaravelElasticaBridge\Tests;
44

5-
use Elastica\Document;
65
use Limenet\LaravelElasticaBridge\Tests\App\Elasticsearch\CustomerIndex;
7-
use Limenet\LaravelElasticaBridge\Tests\App\Models\Customer;
86

97
class IndexTest extends TestCase
108
{
11-
protected CustomerIndex $customerIndex;
12-
13-
public function setUp():void {
9+
protected CustomerIndex $customerIndex;
1410

11+
public function setUp():void
12+
{
1513
parent::setUp();
1614

1715
$this->customerIndex = $this->app->make(CustomerIndex::class);
1816
}
1917
/** @test */
2018
public function index_settings()
2119
{
22-
$settings=$this->customerIndex->getCreateArguments();
23-
if($this->customerIndex->hasMapping()){
24-
$this->assertArrayHasKey('mappings',$settings);
20+
$settings = $this->customerIndex->getCreateArguments();
21+
if ($this->customerIndex->hasMapping()) {
22+
$this->assertArrayHasKey('mappings', $settings);
2523
}
2624
}
2725
}

tests/ModelTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
class ModelTest extends TestCase
1010
{
11-
protected CustomerIndex $customerIndex;
12-
13-
public function setUp():void {
11+
protected CustomerIndex $customerIndex;
1412

13+
public function setUp():void
14+
{
1515
parent::setUp();
1616

1717
$this->customerIndex = $this->app->make(CustomerIndex::class);
@@ -20,11 +20,11 @@ public function setUp():void {
2020
public function convert_to_elastica_document()
2121
{
2222
/** @var Customer $customer */
23-
$customer=Customer::first();
23+
$customer = Customer::first();
2424
$document = $customer->toElasticaDocument($this->customerIndex);
2525
$this->assertInstanceOf(Document::class, $document);
2626

27-
$this->assertSame($customer->name,$document->get('name'));
28-
$this->assertSame($customer->email,$document->get('email'));
27+
$this->assertSame($customer->name, $document->get('name'));
28+
$this->assertSame($customer->email, $document->get('email'));
2929
}
3030
}

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class TestCase extends Orchestra
1313
{
14-
// use RefreshDatabase;
14+
// use RefreshDatabase;
1515
public function setUp(): void
1616
{
1717
parent::setUp();

tests/database/factories/CustomerFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace Limenet\LaravelElasticaBridge\Tests\Database\Factories;
44

5-
use App\Models\User;
65
use Illuminate\Database\Eloquent\Factories\Factory;
7-
use Illuminate\Support\Str;
86
use Limenet\LaravelElasticaBridge\Tests\App\Models\Customer;
97

108
class CustomerFactory extends Factory
@@ -26,7 +24,7 @@ public function definition()
2624
return [
2725
'name' => $this->faker->name(),
2826
'email' => $this->faker->unique()->safeEmail(),
29-
'type'=>$this->faker->randomElement(['small','medium','big'])
27+
'type' => $this->faker->randomElement(['small','medium','big']),
3028
];
3129
}
3230
}

tests/database/seeders/DatabaseSeeder.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
namespace Limenet\LaravelElasticaBridge\Tests\Database\Seeders;
44

55
use Illuminate\Database\Seeder;
6-
use Illuminate\Support\Facades\DB;
7-
use Illuminate\Support\Facades\Hash;
8-
use Illuminate\Support\Str;
96
use Limenet\LaravelElasticaBridge\Tests\App\Models\Customer;
107

118
class DatabaseSeeder extends Seeder

0 commit comments

Comments
 (0)