The Clean Architecture in php


namespace CleanPhp\Invoicer\Domain\Repository; interface



Download 2,26 Mb.
Pdf ko'rish
bet140/179
Sana24.06.2021
Hajmi2,26 Mb.
#100337
1   ...   136   137   138   139   140   141   142   143   ...   179
Bog'liq
The-Clean-Architecture-in-PHP-Kristopher-Wilson

namespace
CleanPhp\Invoicer\Domain\Repository;
interface
OrderRepositoryInterface
extends
RepositoryInterface {
public function
getUninvoicedOrders
();
}
This
getUninvoicedOrders()
method can be used to get all the orders when our invoicing service
runs.
Invoice Factory
Invoices are created for Orders, and inherit some of their data, so it makes sense that we would
encapsulate the creation of these Invoices into a factory service.
This simple factory should accept an
Order
object, and return an
Invoice
object to the caller:
public function
createFromOrder
(Order
$order
);
Let’s start by wring a test that’s going to define this service. We’ll use the awesome
Peridot³⁴
testing framework that follows a Behavior-Driven Development (BDD) approach to testing.
Let’s install the latest stable version as a development dependency via Composer:
³⁴
http://peridot-php.github.io


Building Our Domain
109
composer
require
--
dev peridot
-
php
/
peridot
Once it’s installed, we can run it with the command:
./
vendor
/
bin
/
peridot
If all goes well, you’ll see Peridot run it’s own tests. That’s great, but we want to run our tests. But
before we do that, we’ll have to write them. Let’s start by creating a root level
specs/
directory
for our test specs to live in.
Let’s write our first test:
// specs/domain/service/invoice-factory.spec.php

Download 2,26 Mb.

Do'stlaringiz bilan baham:
1   ...   136   137   138   139   140   141   142   143   ...   179




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish