Skip to content

Commit a70b743

Browse files
oliverkleeSam Tuke
authored andcommitted
[TASK] Add tests that a Subscription can be saved (#281)
1 parent 39e522b commit a70b743

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Integration/Domain/Repository/Subscription/SubscriptionRepositoryTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,29 @@ public function findBySubscriberListFindsSubscriptionOnlyWithTheGivenSubscriberL
217217
}
218218
}
219219

220+
/**
221+
* @test
222+
*/
223+
public function savePersistsAndFlushesModel()
224+
{
225+
$this->getDataSet()->addTable(static::SUBSCRIBER_TABLE_NAME, __DIR__ . '/../Fixtures/Subscriber.csv');
226+
$this->getDataSet()->addTable(static::SUBSCRIBER_LIST_TABLE_NAME, __DIR__ . '/../Fixtures/SubscriberList.csv');
227+
$this->touchDatabaseTable(static::TABLE_NAME);
228+
$this->applyDatabaseChanges();
229+
$numberOfSaveModelsBefore = count($this->subject->findAll());
230+
231+
$model = new Subscription();
232+
/** @var Subscriber $subscriber */
233+
$subscriber = $this->subscriberRepository->find(1);
234+
$model->setSubscriber($subscriber);
235+
/** @var SubscriberList $subscriber */
236+
$subscriberList = $this->subscriberListRepository->find(1);
237+
$model->setSubscriberList($subscriberList);
238+
$this->subject->save($model);
239+
240+
static::assertCount($numberOfSaveModelsBefore + 1, $this->subject->findAll());
241+
}
242+
220243
/**
221244
* @test
222245
*/

0 commit comments

Comments
 (0)