O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Illustrated by examples
2.0.0-BETA1
http://phpspec.net
http://github.com/phpspec/phpspec
Marcello Duarte | @_md
Konstantin...
generate or edit specs
run the specs
edit code generate code
Installation
Create a composer.json file:
Installation
Get composer, if you don’t have it already
Installation
Install
Generate Specs
$
Generated Specs
Edit the Spec
Run Specs
$
Generate Code
Generated Code
Edit Code
Run Specs
$
:)
Matchers
object expectation matcher
$result
->should
->shouldNot
->should
->shouldNot
Be...()Be...()$result
Types of Matchers
Identity
Comparison
Throw
Type
Object State
Inline
Identity
$this->greet()->shouldReturn('Hello, World!');
$this->greet()->shouldBe('Hello, World!');
$this->greet()->shouldB...
Comparison
$this->greet()->shouldBeLike('Hello, World!');
==
Throw
$this->shouldThrow('EndOfTheWorld')->duringGreet();
$this->shouldThrow('EndOfTheWorld')->during('greet');
$this->gre...
Type
$this->greet()->shouldBeAnInstanceOf('Greeting');
$this->greet()->returnAnInstanceOf('Greeting');
$this->greet()->hav...
Object State
class ShoppingCartSpec extends ObjectBehavior
{
function it_is_created_empty()
{
$this->shouldNotHaveItems();...
Object State
class LifeSpec extends ObjectBehavior
{
function it_is_simple()
{
$this->shouldBeSimple();
}
}
class Life
{
p...
Inline
class NeoSpec extends ObjectBehavior {
function it_should_be_the_one()
{
$this->shouldBeTheOne();
}
function getMat...
Formatters
Progress
$
Dot
$ -fdot
Pretty
$ -fpretty
Nyan
$ -fnyan
Let & Let go
Constructors
Stubbing
Mocking
More
github.com/phpspec/phpspec
phpspec.net
groups.google.com/forum/#!forum/phpspec-dev
twitter.com/phpspec
Próximos SlideShares
Carregando em…5
×

de

PhpSpec 2.0 ilustrated by examples Slide 1 PhpSpec 2.0 ilustrated by examples Slide 2 PhpSpec 2.0 ilustrated by examples Slide 3 PhpSpec 2.0 ilustrated by examples Slide 4 PhpSpec 2.0 ilustrated by examples Slide 5 PhpSpec 2.0 ilustrated by examples Slide 6 PhpSpec 2.0 ilustrated by examples Slide 7 PhpSpec 2.0 ilustrated by examples Slide 8 PhpSpec 2.0 ilustrated by examples Slide 9 PhpSpec 2.0 ilustrated by examples Slide 10 PhpSpec 2.0 ilustrated by examples Slide 11 PhpSpec 2.0 ilustrated by examples Slide 12 PhpSpec 2.0 ilustrated by examples Slide 13 PhpSpec 2.0 ilustrated by examples Slide 14 PhpSpec 2.0 ilustrated by examples Slide 15 PhpSpec 2.0 ilustrated by examples Slide 16 PhpSpec 2.0 ilustrated by examples Slide 17 PhpSpec 2.0 ilustrated by examples Slide 18 PhpSpec 2.0 ilustrated by examples Slide 19 PhpSpec 2.0 ilustrated by examples Slide 20 PhpSpec 2.0 ilustrated by examples Slide 21 PhpSpec 2.0 ilustrated by examples Slide 22 PhpSpec 2.0 ilustrated by examples Slide 23 PhpSpec 2.0 ilustrated by examples Slide 24 PhpSpec 2.0 ilustrated by examples Slide 25 PhpSpec 2.0 ilustrated by examples Slide 26 PhpSpec 2.0 ilustrated by examples Slide 27 PhpSpec 2.0 ilustrated by examples Slide 28 PhpSpec 2.0 ilustrated by examples Slide 29 PhpSpec 2.0 ilustrated by examples Slide 30 PhpSpec 2.0 ilustrated by examples Slide 31 PhpSpec 2.0 ilustrated by examples Slide 32 PhpSpec 2.0 ilustrated by examples Slide 33
Próximos SlideShares
TDD with PhpSpec - Lone Star PHP 2016
Avançar
Transfira para ler offline e ver em ecrã inteiro.

30 gostaram

Compartilhar

Baixar para ler offline

PhpSpec 2.0 ilustrated by examples

Baixar para ler offline

An quick introduction to those wanting to get started with phpspec

PhpSpec 2.0 ilustrated by examples

  1. 1. Illustrated by examples 2.0.0-BETA1 http://phpspec.net http://github.com/phpspec/phpspec Marcello Duarte | @_md Konstantin Kudryashov | @everzet
  2. 2. generate or edit specs run the specs edit code generate code
  3. 3. Installation Create a composer.json file:
  4. 4. Installation Get composer, if you don’t have it already
  5. 5. Installation Install
  6. 6. Generate Specs $
  7. 7. Generated Specs
  8. 8. Edit the Spec
  9. 9. Run Specs $
  10. 10. Generate Code
  11. 11. Generated Code
  12. 12. Edit Code
  13. 13. Run Specs $
  14. 14. :)
  15. 15. Matchers object expectation matcher $result ->should ->shouldNot ->should ->shouldNot Be...()Be...()$result
  16. 16. Types of Matchers Identity Comparison Throw Type Object State Inline
  17. 17. Identity $this->greet()->shouldReturn('Hello, World!'); $this->greet()->shouldBe('Hello, World!'); $this->greet()->shouldBeEqualTo('Hello, World!'); $this->greet()->shouldEqual('Hello, World!'); ===
  18. 18. Comparison $this->greet()->shouldBeLike('Hello, World!'); ==
  19. 19. Throw $this->shouldThrow('EndOfTheWorld')->duringGreet(); $this->shouldThrow('EndOfTheWorld')->during('greet'); $this->greet() ->shouldThrow(new Exception('the end')) ->duringGreet('some argument'); $this->greet()->shouldThrow('EndOfTheWorld') ->during('greet', array('some argument'));
  20. 20. Type $this->greet()->shouldBeAnInstanceOf('Greeting'); $this->greet()->returnAnInstanceOf('Greeting'); $this->greet()->haveType('Greeting');
  21. 21. Object State class ShoppingCartSpec extends ObjectBehavior { function it_is_created_empty() { $this->shouldNotHaveItems(); } } class ShoppingCart { public function hasItems() {} } has -> have
  22. 22. Object State class LifeSpec extends ObjectBehavior { function it_is_simple() { $this->shouldBeSimple(); } } class Life { public function isSimple() {} } is -> be
  23. 23. Inline class NeoSpec extends ObjectBehavior { function it_should_be_the_one() { $this->shouldBeTheOne(); } function getMatchers() { return [ 'beTheOne' => function($actual) { return $actual instanceof TheOne; } ]; } }
  24. 24. Formatters
  25. 25. Progress $
  26. 26. Dot $ -fdot
  27. 27. Pretty $ -fpretty
  28. 28. Nyan $ -fnyan
  29. 29. Let & Let go
  30. 30. Constructors
  31. 31. Stubbing
  32. 32. Mocking
  33. 33. More github.com/phpspec/phpspec phpspec.net groups.google.com/forum/#!forum/phpspec-dev twitter.com/phpspec
  • WaqasAhmed153

    Aug. 11, 2016
  • JamesBenner

    Mar. 5, 2016
  • PierreTomasina

    Feb. 6, 2016
  • ssuser354a69

    Sep. 23, 2015
  • WordpressDev

    Jun. 24, 2015
  • LusBarrosNbrega

    Jun. 14, 2015
  • alexeyshockov

    Jun. 9, 2015
  • ArnaudLanglade

    Apr. 21, 2015
  • jcchavezs

    Mar. 31, 2015
  • JrgenvanDijk

    Mar. 1, 2015
  • GustavoLK

    Feb. 8, 2015
  • kidbrax

    Jan. 27, 2015
  • herucimay

    Dec. 22, 2014
  • JiangYu7408

    Dec. 10, 2014
  • Rmed19

    Nov. 19, 2014
  • bjeavons

    Nov. 7, 2014
  • meth

    Oct. 14, 2014
  • PeterKeithFox

    Oct. 3, 2014
  • bitcreator

    Jun. 3, 2014
  • avandrevitor

    May. 27, 2014

An quick introduction to those wanting to get started with phpspec

Vistos

Vistos totais

13.080

No Slideshare

0

De incorporações

0

Número de incorporações

53

Ações

Baixados

88

Compartilhados

0

Comentários

0

Curtir

30

×