Permalink
Browse files

HelloWorld#sayHelloToSomeone takes a Person object as an argument and…

… uses Person#getName, but PhpSpec complains because the method is undefined. As a bonus by stubbing the previously undefined Person class, PhpSpec offers to create it
  • Loading branch information...
peterjmit committed Apr 30, 2013
1 parent f2cfc57 commit 08d5ba9098afd090f56632a45429047e9843e7c8
Showing with 20 additions and 0 deletions.
  1. +10 −0 spec/HelloWorldSpec.php
  2. +5 −0 src/HelloWorld.php
  3. +5 −0 src/Person.php
View
@@ -16,4 +16,14 @@ function it_should_say_hello()
{
$this->sayHello()->shouldReturn('Hello!');
}
/**
* @param Person $person
*/
function it_should_say_hello_to_someone($person)
{
$person->getName()->willReturn('Steve');
$this->sayHelloToSomeone($person)->shouldReturn('Hello Steve');
}
}
View
@@ -6,4 +6,9 @@ public function sayHello()
{
return 'Hello!';
}
public function sayHelloToSomeone(Person $person)
{
return $this->sayHello() . ' ' . $person->getName();
}
}
View
@@ -0,0 +1,5 @@
<?php
class Person
{
}

0 comments on commit 08d5ba9

Please sign in to comment.