Skip to content

Instantly share code, notes, and snippets.

@SelrahcD
Last active December 2, 2015 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SelrahcD/f479dd6d3edd385988fd to your computer and use it in GitHub Desktop.
Save SelrahcD/f479dd6d3edd385988fd to your computer and use it in GitHub Desktop.
<?php
class Discussion
{
private $id;
private function __construct(DiscussionId $discussionId)
{
$this->id = $discussionId;
}
public function equals(Discussion $discussion)
{
return $this->id->equals($discussion->id);
}
}
<?php
class DiscussionId
{
private $id;
public function __construct($d)
{
$this->id = $id;
}
public function equals(DiscussionId $discussionId)
{
return $this->id === $discussionId->id;
}
}

The problem is : What is the proper way to test discussion's method equals with PhpSpec.

@SelrahcD
Copy link
Author

SelrahcD commented Dec 2, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment