Skip to content

Commit 3ec8b18

Browse files
committed
style fix
1 parent 802a074 commit 3ec8b18

File tree

3 files changed

+41
-26
lines changed

3 files changed

+41
-26
lines changed

src/Doctrine/Listener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace FOS\ElasticaBundle\Doctrine;
1313

1414
use Doctrine\Persistence\Event\LifecycleEventArgs;
15-
use FOS\ElasticaBundle\Doctrine\ConditionalUpdate;
1615
use FOS\ElasticaBundle\Persister\ObjectPersister;
1716
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
1817
use FOS\ElasticaBundle\Provider\IndexableInterface;

tests/Unit/Doctrine/ConditionalUpdateEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function shouldBeUpdated(): bool
3434
{
3535
return $this->shouldBeUpdated;
3636
}
37-
37+
3838
public function setShouldBeUpdated(bool $shouldBeUpdated): void
3939
{
4040
$this->shouldBeUpdated = $shouldBeUpdated;

tests/Unit/Doctrine/ConditionalUpdateListenerTest.php

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,33 @@ public function testEntityWithConditionalUpdateTrueIsIndexed()
2828
$entity = $this->createMock(ConditionalUpdate::class);
2929
$entity->expects($this->once())
3030
->method('shouldBeUpdated')
31-
->willReturn(true);
31+
->willReturn(true)
32+
;
3233

3334
$persister = $this->createMock(ObjectPersisterInterface::class);
3435
$persister->expects($this->once())
3536
->method('handlesObject')
3637
->with($entity)
37-
->willReturn(true);
38+
->willReturn(true)
39+
;
3840

3941
$indexable = $this->createMock(IndexableInterface::class);
4042
$indexable->expects($this->once())
4143
->method('isObjectIndexable')
4244
->with('index_name', $entity)
43-
->willReturn(true);
45+
->willReturn(true)
46+
;
4447

4548
$eventArgs = $this->createMock(LifecycleEventArgs::class);
4649
$eventArgs->expects($this->once())
4750
->method('getObject')
48-
->willReturn($entity);
51+
->willReturn($entity)
52+
;
4953

5054
$listener = new Listener($persister, $indexable, ['indexName' => 'index_name']);
51-
55+
5256
$listener->postPersist($eventArgs);
53-
57+
5458
$this->assertContains($entity, $listener->scheduledForInsertion);
5559
}
5660

@@ -60,33 +64,37 @@ public function testEntityWithConditionalUpdateFalseIsNotIndexed()
6064
$entity = $this->createMock(ConditionalUpdate::class);
6165
$entity->expects($this->once())
6266
->method('shouldBeUpdated')
63-
->willReturn(false);
67+
->willReturn(false)
68+
;
6469

6570
// Mock dependencies
6671
$persister = $this->createMock(ObjectPersisterInterface::class);
6772
$persister->expects($this->once())
6873
->method('handlesObject')
6974
->with($entity)
70-
->willReturn(true);
75+
->willReturn(true)
76+
;
7177

7278
$indexable = $this->createMock(IndexableInterface::class);
7379
$indexable->expects($this->once())
7480
->method('isObjectIndexable')
7581
->with('index_name', $entity)
76-
->willReturn(true);
82+
->willReturn(true)
83+
;
7784

7885
// Create the event args
7986
$eventArgs = $this->createMock(LifecycleEventArgs::class);
8087
$eventArgs->expects($this->once())
8188
->method('getObject')
82-
->willReturn($entity);
89+
->willReturn($entity)
90+
;
8391

8492
// Create listener
8593
$listener = new Listener($persister, $indexable, ['indexName' => 'index_name']);
86-
94+
8795
// Test postPersist
8896
$listener->postPersist($eventArgs);
89-
97+
9098
// Check if entity is NOT in scheduledForInsertion
9199
$this->assertEmpty($listener->scheduledForInsertion);
92100
}
@@ -97,33 +105,37 @@ public function testEntityWithConditionalUpdateTrueIsUpdated()
97105
$entity = $this->createMock(ConditionalUpdate::class);
98106
$entity->expects($this->once())
99107
->method('shouldBeUpdated')
100-
->willReturn(true);
108+
->willReturn(true)
109+
;
101110

102111
// Mock dependencies
103112
$persister = $this->createMock(ObjectPersisterInterface::class);
104113
$persister->expects($this->once())
105114
->method('handlesObject')
106115
->with($entity)
107-
->willReturn(true);
116+
->willReturn(true)
117+
;
108118

109119
$indexable = $this->createMock(IndexableInterface::class);
110120
$indexable->expects($this->once())
111121
->method('isObjectIndexable')
112122
->with('index_name', $entity)
113-
->willReturn(true);
123+
->willReturn(true)
124+
;
114125

115126
// Create the event args
116127
$eventArgs = $this->createMock(LifecycleEventArgs::class);
117128
$eventArgs->expects($this->once())
118129
->method('getObject')
119-
->willReturn($entity);
130+
->willReturn($entity)
131+
;
120132

121133
// Create listener
122134
$listener = new Listener($persister, $indexable, ['indexName' => 'index_name']);
123-
135+
124136
// Test postUpdate
125137
$listener->postUpdate($eventArgs);
126-
138+
127139
// Check if entity is in scheduledForUpdate
128140
$this->assertContains($entity, $listener->scheduledForUpdate);
129141
}
@@ -134,33 +146,37 @@ public function testEntityWithConditionalUpdateFalseIsNotUpdated()
134146
$entity = $this->createMock(ConditionalUpdate::class);
135147
$entity->expects($this->once())
136148
->method('shouldBeUpdated')
137-
->willReturn(false);
149+
->willReturn(false)
150+
;
138151

139152
// Mock dependencies
140153
$persister = $this->createMock(ObjectPersisterInterface::class);
141154
$persister->expects($this->once())
142155
->method('handlesObject')
143156
->with($entity)
144-
->willReturn(true);
157+
->willReturn(true)
158+
;
145159

146160
$indexable = $this->createMock(IndexableInterface::class);
147161
$indexable->expects($this->once())
148162
->method('isObjectIndexable')
149163
->with('index_name', $entity)
150-
->willReturn(true);
164+
->willReturn(true)
165+
;
151166

152167
// Create the event args
153168
$eventArgs = $this->createMock(LifecycleEventArgs::class);
154169
$eventArgs->expects($this->once())
155170
->method('getObject')
156-
->willReturn($entity);
171+
->willReturn($entity)
172+
;
157173

158174
// Create listener
159175
$listener = new Listener($persister, $indexable, ['indexName' => 'index_name']);
160-
176+
161177
// Test postUpdate
162178
$listener->postUpdate($eventArgs);
163-
179+
164180
// Check if entity is NOT in scheduledForUpdate
165181
$this->assertEmpty($listener->scheduledForUpdate);
166182
}

0 commit comments

Comments
 (0)