All Projects โ†’ JMLamodiere โ†’ tdd-demo-forumphp2020

JMLamodiere / tdd-demo-forumphp2020

Licence: MIT License
Live coding examples used during Forum PHP 2020 talk "Too many mocks killed the test: What Hexagonal Architecture has changed"

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to tdd-demo-forumphp2020

Php Ddd Example
๐Ÿ˜๐ŸŽฏ Hexagonal Architecture + DDD + CQRS in PHP using Symfony 5
Stars: โœญ 1,960 (+7740%)
Mutual labels:  ddd, behat, hexagonal-architecture
kingdom-python-server
Modular, cohesive, transparent and fast web server template
Stars: โœญ 20 (-20%)
Mutual labels:  ddd, hexagonal-architecture
bdd-for-all
Flexible and easy to use library to enable your behavorial driven development (BDD) teams to easily collaborate while promoting automation, transparency and reporting.
Stars: โœญ 42 (+68%)
Mutual labels:  tdd, ddd
teamo-ddd-example
Implementing Domain Driven Design in PHP using Laravel
Stars: โœญ 46 (+84%)
Mutual labels:  ddd, hexagonal-architecture
DDD
Domain-Driven Design example
Stars: โœญ 116 (+364%)
Mutual labels:  ddd, hexagonal-architecture
permacoop
Open source and eco design ERP solution reserved for worker-owned business.
Stars: โœญ 167 (+568%)
Mutual labels:  ddd, hexagonal-architecture
typescript-ddd-example
๐Ÿ”ท๐ŸŽฏ TypeScript DDD Example: Complete project applying Hexagonal Architecture and Domain-Driven Design patterns
Stars: โœญ 607 (+2328%)
Mutual labels:  ddd, hexagonal-architecture
Clean Architecture Manga
๐ŸŒ€ Clean Architecture with .NET6, C#10 and React+Redux. Use cases as central organizing structure, completely testable, decoupled from frameworks
Stars: โœญ 3,104 (+12316%)
Mutual labels:  tdd, hexagonal-architecture
cart
Domain-Driven Design shop cart demonstration
Stars: โœญ 80 (+220%)
Mutual labels:  tdd, ddd
go-hexagonal http api-course
Ejemplos del curso de API HTTP en Go aplicando Arquitectura Hexagonal
Stars: โœญ 78 (+212%)
Mutual labels:  ddd, hexagonal-architecture
symfony-prooph-example
prooph in symfony example
Stars: โœญ 19 (-24%)
Mutual labels:  tdd, ddd
finance-project-ddd
Projeto financeiro usando domain driven design, tdd, arquitetura hexagonal e solid
Stars: โœญ 67 (+168%)
Mutual labels:  tdd, hexagonal-architecture
repository
[PHP 7] Implementation and definition of a base Repository in Domain land.
Stars: โœญ 26 (+4%)
Mutual labels:  ddd, hexagonal-architecture
ema
External memory app - allows one to quickly post and search text notes
Stars: โœญ 43 (+72%)
Mutual labels:  tdd, ddd
Cqrs Clean Eventual Consistency
CQRS, using Clean Architecture, multiple databases and Eventual Consistency
Stars: โœญ 247 (+888%)
Mutual labels:  tdd, ddd
educational-platform
Modular Monolith Java application with DDD
Stars: โœญ 124 (+396%)
Mutual labels:  ddd, hexagonal-architecture
ddd-for-python
A domain-driven design framework for Python.
Stars: โœญ 30 (+20%)
Mutual labels:  ddd, hexagonal-architecture
Migration
ใ€Š็ณป็ปŸ้‡ๆž„ไธŽ่ฟ็งปๆŒ‡ๅ—ใ€‹ๆ‰‹ๆŠŠๆ‰‹ๆ•™ไฝ ๅˆ†ๆžใ€่ฏ„ไผฐ็Žฐๆœ‰็ณป็ปŸใ€ๅˆถๅฎš้‡ๆž„็ญ–็•ฅใ€ๆŽข็ดขๅฏ่กŒ้‡ๆž„ๆ–นๆกˆใ€ๆญๅปบๆต‹่ฏ•้˜ฒๆŠค็ฝ‘ใ€่ฟ›่กŒ็ณป็ปŸๆžถๆž„้‡ๆž„ใ€ๆœๅŠกๆžถๆž„้‡ๆž„ใ€ๆจกๅ—้‡ๆž„ใ€ไปฃ็ ้‡ๆž„ใ€ๆ•ฐๆฎๅบ“้‡ๆž„ใ€้‡ๆž„ๅŽ็š„ๆžถๆž„ๅฎˆๆŠค
Stars: โœญ 2,753 (+10912%)
Mutual labels:  tdd, ddd
Dotnet New Caju
Learn Clean Architecture with .NET Core 3.0 ๐Ÿ”ฅ
Stars: โœญ 228 (+812%)
Mutual labels:  tdd, ddd
ftgogo
FTGOGO - event-driven architecture demonstration application using edat
Stars: โœญ 82 (+228%)
Mutual labels:  ddd, hexagonal-architecture

TDD Demo - ForumPHP 2020

Build Status

Live coding examples used during Forum PHP 2020 talk:

For a bit of theory, see ๐Ÿ‡ซ๐Ÿ‡ท De CRUD ร  DDD, comment Meetic a sauvรฉ son legacy

Steps by step refactoring

โš ๏ธ Warning : Only steps 1 & 2 are really considered bad. Next steps just show different testing styles.

  1. bad_implementation branch contains :
    • Architecture mistakes according to Hexagonal architecture (aka Port & Adapters)
    • Tests too much coupled with implementation details, and an incorrect usage of mocks
  2. bad_tests branch (see Pull Request) only fixes (some) hexagonal mistakes. Many obscure changes are required in the tests, proving they do not help much during refactoring
  3. integration_infra_medium_domain branch (see Pull Request) split tests this way:
    • Domain logic (Application/Domain folders): medium Unit tests, mocking only infrastructure
    • Technical logic (Infrastructure folder): integration tests for each specific technology
  4. integration_infra_medium_domain_wiremock branch (see Pull Request) only replaces Guzzle MockHandler with Wiremock, decoupling HTTP tests with the library being used for HTTP calls.
  5. integration_infra_medium_domain_no_di branch (see Pull Request) removes Dependency Injection Container usage and manually build tested classes instead.
  6. integration_infra_sociable branch (see Pull Request) replaces medium sized tests with Overlapping Sociable Tests to allow easily test and evolve individual behaviours (ex : class serialization) while still being able to split/merge/refactor classes inside some class clusters by not checking specific calls between them.
  7. mock_secondary_ports_in_behat branch (see Pull Request): Mock Secondary Ports (according to Hexagonal architecture) in Behat. Makes behat tests much faster and easier to write. Pre-requisite : well defined secondary ports and Integration tests on their Infrastructure layer implementation.

API documentation

Example :

curl -i -X PUT "https://virtserver.swaggerhub.com/JMLamodiere/tdd-demo_forum_php_2020/1.0.0/runningsessions/42" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{\"id\":42,\"distance\":5.5,\"shoes\":\"Adadis Turbo2\"}"

Makefile

Run make or make help to see available commands.

Test environment

Pre-requisites :

Run tests with:

make install
make test

Dev environment

Pre-requisites (see composer.json) :

Create an App on AccuWeather and copy your API Key:

# in /.env.dev.local
ACCUWEATHER_API_KEY=xxx

Start local dev environment with:

composer install
make start

Postgresql

To access Postgresql database, configure a tool such as Database Tools and SQL included in PHPStorm:

  • URL: jdbc:postgresql://localhost:32774/forumphp (replace 32774 with the port given by make ps command)
  • login: forumphp
  • password: forumphp (see docker-compose.yml)

Wiremock

See Swagger UI documentation at http://localhost:32775/__admin/swagger-ui/

Replace 32775 with the port given by make ps command

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].