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