Slide 1

Slide 1 text

spec-gen phpspec extension taking code generation to the next level Loïc Faugeron http://constant.co @epiloic

Slide 2

Slide 2 text

Hi! @epiloic 2

Slide 3

Slide 3 text

Loïc Faugeron gnugat @epiloic Blog - https://gnugat.github.io 3

Slide 4

Slide 4 text

Constant Commerce Start-up in London @epiloic Site - http://constant.co 4

Slide 5

Slide 5 text

PHP 7, Symfony 3, phpspec Come work with us! @epiloic 5

Slide 6

Slide 6 text

lightning talk @epiloic 6

Slide 7

Slide 7 text

spec-gen @epiloic 7 spec-gen official website - http://memio.github.io/spec-gen/

Slide 8

Slide 8 text

extension for phpspec @epiloic 8 phpspec official website - http://www.phpspec.net/en/stable/

Slide 9

Slide 9 text

test framework (rspec) @epiloic 9

Slide 10

Slide 10 text

TDD++ @epiloic 10

Slide 11

Slide 11 text

1 create test phpspec describe 'MarsRover\LocateRover’ @epiloic 11

Slide 12

Slide 12 text

bootstrapped by phpspec

Slide 13

Slide 13 text

1’ edit test @epiloic 13

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

2 run test phpspec run @epiloic 15

Slide 16

Slide 16 text

2’ fail class MarsRover\FindLatestLocation not found @epiloic 16

Slide 17

Slide 17 text

bootstrapped by phpspec

Slide 18

Slide 18 text

2’’ fail method MarsRover\FindLatestLocation::find() undefined @epiloic 18

Slide 19

Slide 19 text

bootstrapped by phpspec

Slide 20

Slide 20 text

2’’’ fail class MarsRover\LocateRover not found @epiloic 20

Slide 21

Slide 21 text

bootstrapped by phpspec

Slide 22

Slide 22 text

2’’’’ fail method MarsRover\LocateRover::__construct() undefined @epiloic 22

Slide 23

Slide 23 text

bootstrapped by phpspec

Slide 24

Slide 24 text

2’’’’’ fail method MarsRover\LocateRover::locate() undefined @epiloic 24

Slide 25

Slide 25 text

bootstrapped by phpspec

Slide 26

Slide 26 text

2’’’’’’ fail MarsRover\LocateRover::locate() returned null @epiloic 26

Slide 27

Slide 27 text

3 write code Usually copy/paste test, and adapt @epiloic 27

Slide 28

Slide 28 text

spec-gen improved code generation @epiloic 28

Slide 29

Slide 29 text

Improvement #1 argument type hints @epiloic 29

Slide 30

Slide 30 text

Improvement #2 argument names @epiloic 30

Slide 31

Slide 31 text

Improvement #3 dependency injection @epiloic 31

Slide 32

Slide 32 text

bootstrapped by spec-gen

Slide 33

Slide 33 text

what's next? @epiloic 33

Slide 34

Slide 34 text

return type hints spec-gen v0.8 @epiloic 34

Slide 35

Slide 35 text

method body? copy test, paste in code and adapt @epiloic 35

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

but hard to implement ¯\_(ツ)_/¯ @epiloic 37

Slide 38

Slide 38 text

http://memio.github.io/spec-gen thank you @epiloic 38