Skip to Content
Domain-Driven Design in PHP
book

Domain-Driven Design in PHP

by Keyvan Akbary, Carlos Buenosvinos, Christian Soronellas
June 2017
Intermediate to advanced
394 pages
8h 52m
English
Packt Publishing
Content preview from Domain-Driven Design in PHP

Test Data Builder

Test Data Builders are just normal Builders with default values used exclusively in your test suites so that you don't have to specify irrelevant parameters on specific test cases:

class AuthorBuilder{    private $username;    private $email ;    private $fullName;    private function __construct()    {        $this->username = new Username('johndoe');        $this->email = new Email('john@doe.com');        $this->fullName = new FullName('John', 'Doe');    }    public static function anAuthor()    {        return new self();    }    public function withFullName(FullName $aFullName)    {        $this->fullName = $aFullName;        return $this;    }    public function withUsername(Username $aUsername)    {        $this->username = $aUsername;        return $this;    }    public function withEmail(Email $anEmail)    { $this->email ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Web Services

PHP Web Services

Lorna Jane Mitchell
PHP Microservices

PHP Microservices

Pablo Solar Vilariño, Carlos Pérez Sánchez

Publisher Resources

ISBN: 9781787284944