6 declare(strict_types=1);
20 use PHPUnit\Framework\TestCase;
37 private $commandGetList;
47 private $searchResult;
52 private $sourceRepository;
56 $this->commandSave = $this->getMockBuilder(SaveInterface::class)->getMock();
57 $this->commandGet = $this->getMockBuilder(GetInterface::class)->getMock();
58 $this->commandGetList = $this->getMockBuilder(GetListInterface::class)->getMock();
59 $this->source = $this->getMockBuilder(SourceInterface::class)->getMock();
60 $this->searchResult = $this->getMockBuilder(SourceSearchResultsInterface::class)->getMock();
62 $this->sourceRepository = (
new ObjectManager($this))->getObject(
63 SourceRepository::class,
65 'commandSave' => $this->commandSave,
66 'commandGet' => $this->commandGet,
67 'commandGetList' => $this->commandGetList,
77 ->expects($this->once())
82 $this->sourceRepository->save($this->source);
92 ->expects($this->once())
97 $this->sourceRepository->save($this->source);
105 ->expects($this->once())
108 ->willReturn($this->source);
110 self::assertEquals($this->source, $this->sourceRepository->get(
$sourceCode));
122 ->expects($this->once())
132 $this->commandGetList
133 ->expects($this->once())
136 ->willReturn($this->searchResult);
138 self::assertEquals($this->searchResult, $this->sourceRepository->getList());
143 $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class)->getMock();
145 $this->commandGetList
146 ->expects($this->once())
149 ->willReturn($this->searchResult);
151 self::assertEquals($this->searchResult, $this->sourceRepository->getList(
$searchCriteria));
testSaveWithCouldNotSaveException()
testGetWithNoSuchEntityException()
testGetListWithoutSearchCriteria()
testGetListWithSearchCriteria()