/** *@test */ public function text_for_returns_a_default_value_if_supplied_and_if_no_content_value_exists() { $page = ContentRepository::makePage('test'); $page->addTextblock('intro', 'an introduction', false, ''); $this->assertEquals('this is the default', $page->textFor('intro', 'this is the default')); $this->assertEquals('also a default', $page->textFor('nonexisting block', 'also a default')); }
/** *@test */ public function a_textblocks_content_can_be_set() { $page = ContentRepository::makePage('home'); $textblock = $page->addTextblock('intro', 'the introduction', false); $textblock->setContent('Once upon a time, in a land far, far away...'); $this->seeInDatabase('ec_textblocks', ['id' => $textblock->id, 'name' => 'intro', 'content' => 'Once upon a time, in a land far, far away...']); }