The problem is : What is the proper way to test discussion's method equals with PhpSpec.
Last active
December 2, 2015 20:05
-
-
Save SelrahcD/f479dd6d3edd385988fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Discussion | |
{ | |
private $id; | |
private function __construct(DiscussionId $discussionId) | |
{ | |
$this->id = $discussionId; | |
} | |
public function equals(Discussion $discussion) | |
{ | |
return $this->id->equals($discussion->id); | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DiscussionId | |
{ | |
private $id; | |
public function __construct($d) | |
{ | |
$this->id = $id; | |
} | |
public function equals(DiscussionId $discussionId) | |
{ | |
return $this->id === $discussionId->id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I didn't think of a value object as a value instead of a collaborator but yes it makes sens. (Didn't see the big V before object, duh...)
I'm curious, what are the two examples ?
I guess clarifying that a VO is a value as native value would be is one of them but I can't figure what the second would be.