use
CleanPhp\Invoicer\Domain\Entity\Order;
class
InvoiceFactory
{
public function
createFromOrder
(Order
$order
) {
return new
Invoice();
}
}
This is the minimal work needed to get our Peridot tests to pass, but our class obviously still isn’t
work the way we want it to as it’s just returning an empty
Invoice
object. Let’s add a few more
expectations to our test to define the behavior of this factory:
// specs/domain/factory/invoice-factory.spec.php
use
CleanPhp\Invoicer\Domain\Entity\Invoice;
use
CleanPhp\Invoicer\Domain\Entity\Order;
use
CleanPhp\Invoicer\Domain\Factory\InvoiceFactory;
describe(
'InvoiceFactory'
,
function
() {
describe(
'->createFromOrder()'
,
function
() {
it(
'should return an order object'
,
Do'stlaringiz bilan baham: |