Slide 1

Slide 1 text

Introduction Repository, DDD & Unit Tests

Slide 2

Slide 2 text

Agenda - Repository - DDD - Unit Test Case Study : Working on Laravel 5.0

Slide 3

Slide 3 text

Stories - I want to test the data logic but i dont care the data engine (database) - I want to test the data engine (database) but i dont care the data logic automated tests...

Slide 4

Slide 4 text

In Reality

Slide 5

Slide 5 text

Problem? “ the power of united data logic and database, called ORM “

Slide 6

Slide 6 text

Real problem? As programmer we have to make sure every single unit should be working properly.. the keyword is -> every single unit of our code

Slide 7

Slide 7 text

Repository

Slide 8

Slide 8 text

Benefit? - We can test logic without engine - We can test engine without logic - We can test the repository it self easy to mocking… separation of concerns...

Slide 9

Slide 9 text

DDD Solve complex needs by modelling the domain

Slide 10

Slide 10 text

DDD Things - Entity. Unique object - ValueObject. Immutable object

Slide 11

Slide 11 text

Example Users data that contain their credentials like email, username and password. In DDD: User is an entity, password can be a ValueObject.

Slide 12

Slide 12 text

Unit Test 1 class 1 responsibility We should can test each of 1 class without thinking the dependency complexity (replace all dependency with mock)

Slide 13

Slide 13 text

Enough! SHOW ME THE CODES!