◆ setUp()
Definition at line 36 of file InvoiceRepositoryTest.php.
38 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
40 $this->searchResultFactory = $this->getMockBuilder(
41 \
Magento\Sales\Api\Data\InvoiceSearchResultInterfaceFactory::class
43 ->disableOriginalConstructor()
44 ->setMethods([
'create'])
46 $this->collectionProcessorMock = $this->getMockBuilder(CollectionProcessorInterface::class)
49 \
Magento\Sales\Model\Order\InvoiceRepository::class,
51 'invoiceMetadata' => $this->invoiceMetadata,
52 'searchResultFactory' => $this->searchResultFactory,
53 'collectionProcessor' => $this->collectionProcessorMock,
56 $this->type = $this->createPartialMock(\
Magento\Eav\Model\Entity\Type::class, [
'fetchNewIncrementId']);
◆ testCreate()
Definition at line 116 of file InvoiceRepositoryTest.php.
118 $entity = $this->getMockBuilder(\
Magento\Sales\Model\Order\Invoice::class)
119 ->disableOriginalConstructor()
121 $this->invoiceMetadata->expects($this->once())
122 ->method(
'getNewInstance')
124 $this->assertEquals(
$entity, $this->invoice->create());
◆ testDelete()
Definition at line 145 of file InvoiceRepositoryTest.php.
147 $entity = $this->getMockBuilder(\
Magento\Sales\Model\Order\Invoice::class)
148 ->disableOriginalConstructor()
150 $entity->expects($this->once())
151 ->method(
'getEntityId')
155 ->disableOriginalConstructor()
157 $mapper->expects($this->once())
161 $this->invoiceMetadata->expects($this->any())
162 ->method(
'getMapper')
163 ->willReturn($mapper);
165 $this->assertTrue($this->invoice->delete(
$entity));
◆ testDeleteById()
Definition at line 168 of file InvoiceRepositoryTest.php.
172 $entity = $this->getMockBuilder(\
Magento\Sales\Model\Order\Invoice::class)
173 ->disableOriginalConstructor()
175 $entity->expects($this->once())
180 ->method(
'getEntityId')
183 $this->invoiceMetadata->expects($this->once())
184 ->method(
'getNewInstance')
188 ->disableOriginalConstructor()
190 $mapper->expects($this->once())
194 $this->invoiceMetadata->expects($this->any())
195 ->method(
'getMapper')
196 ->willReturn($mapper);
198 $this->assertTrue($this->invoice->deleteById(
$id));
◆ testGet()
Definition at line 59 of file InvoiceRepositoryTest.php.
63 $entity = $this->getMockBuilder(\
Magento\Sales\Model\Order\Invoice::class)
64 ->disableOriginalConstructor()
71 ->method(
'getEntityId')
74 $this->invoiceMetadata->expects($this->once())
75 ->method(
'getNewInstance')
78 $this->assertEquals(
$entity, $this->invoice->get(
$id));
◆ testGetEntityNoId()
@expectedException \Magento\Framework\Exception\NoSuchEntityException @expectedExceptionMessage The entity that was requested doesn't exist. Verify the entity and try again.
Definition at line 94 of file InvoiceRepositoryTest.php.
98 $entity = $this->getMockBuilder(\
Magento\Sales\Model\Order\Invoice::class)
99 ->disableOriginalConstructor()
101 $entity->expects($this->once())
105 $entity->expects($this->once())
106 ->method(
'getEntityId')
109 $this->invoiceMetadata->expects($this->once())
110 ->method(
'getNewInstance')
113 $this->assertNull(
$entity, $this->invoice->get(
$id));
◆ testGetList()
Definition at line 127 of file InvoiceRepositoryTest.php.
130 ->disableOriginalConstructor()
133 ->disableOriginalConstructor()
135 $this->collectionProcessorMock->expects($this->once())
138 $this->searchResultFactory->expects($this->once())
◆ testGetNoId()
@expectedException \Magento\Framework\Exception\InputException @expectedExceptionMessage An ID is needed. Set the ID and try again.
Definition at line 85 of file InvoiceRepositoryTest.php.
87 $this->invoice->get(
null);
◆ testSave()
Definition at line 201 of file InvoiceRepositoryTest.php.
203 $entity = $this->getMockBuilder(\
Magento\Sales\Model\Order\Invoice::class)
204 ->disableOriginalConstructor()
207 ->method(
'getEntityId')
211 ->disableOriginalConstructor()
213 $mapper->expects($this->once())
217 $this->invoiceMetadata->expects($this->any())
218 ->method(
'getMapper')
219 ->willReturn($mapper);
◆ $invoice
◆ $invoiceMetadata
◆ $searchResultFactory
The documentation for this class was generated from the following file: