public function __construct(Uuid $uuid, $title, $content, $description = null) { $this->id = $uuid; $this->title = $title; $this->content = $content; $this->description = $description; $this->status = PublishStatus::draft(); $this->created = new DateTime('now'); }
public function testSerialize() { $draft = PublishStatus::draft(); $usable = PublishStatus::usable(); $withheld = PublishStatus::withheld(); $canceled = PublishStatus::canceled(); $this->assertEquals('"draft"', json_encode($draft)); $this->assertEquals('"usable"', json_encode($usable)); $this->assertEquals('"withheld"', json_encode($withheld)); $this->assertEquals('"canceled"', json_encode($canceled)); }
public function testPostCreation() { $this->assertInstanceOf('App\\Domain\\Post\\Post', $this->post); $this->assertInstanceOf('App\\Domain\\Identity\\Uuid', $this->post->getId()); $this->assertInternalType('string', $this->post->getTitle()); $this->assertInternalType('string', $this->post->getContent()); $this->assertInternalType('string', $this->post->getDescription()); $this->assertInstanceOf('App\\Domain\\Post\\PublishStatus', $this->post->getStatus()); $this->assertTrue(PublishStatus::draft()->equals($this->post->getStatus())); $this->assertInstanceOf('DateTime', $this->post->getCreated()); $this->assertNull($this->post->getPublished()); $this->assertNull($this->post->getModified()); $this->assertNull($this->post->getExpires()); $this->assertFalse($this->post->isPublished()); }