@@ 168-174 (lines=7) @@ | ||
165 | /** @test */ |
|
166 | public function it_can_change_data_when_it_is_creating_event() |
|
167 | { |
|
168 | Event::listen(BlockIsCreating::class, function (BlockIsCreating $event) { |
|
169 | $event->setAttributes(['name' => 'awesome block']); |
|
170 | $event->setAttributes([ |
|
171 | 'en' => ['body' => 'no more lorem! en'], |
|
172 | 'fr' => ['body' => 'no more lorem! fr'], |
|
173 | ]); |
|
174 | }); |
|
175 | ||
176 | $block = $this->block->create(['name' => 'testBlock', 'en' => ['body' => 'lorem en'], 'fr' => ['body' => 'lorem fr']]); |
|
177 | ||
@@ 212-218 (lines=7) @@ | ||
209 | /** @test */ |
|
210 | public function it_can_change_data_when_it_is_updating_event() |
|
211 | { |
|
212 | Event::listen(BlockIsUpdating::class, function (BlockIsUpdating $event) { |
|
213 | $event->setAttributes(['name' => 'awesome block']); |
|
214 | $event->setAttributes([ |
|
215 | 'en' => ['body' => 'no more lorem! en'], |
|
216 | 'fr' => ['body' => 'no more lorem! fr'], |
|
217 | ]); |
|
218 | }); |
|
219 | ||
220 | $block = $this->createRandomBlock(); |
|
221 | $block = $this->block->update($block, ['name' => 'something else']); |