Commit da767d84 authored by Jakub Konečný's avatar Jakub Konečný

made BookPage::$slug and BookPage::$title writable

parent f9080069
Version 2.2.0-dev
- raised minimal version of PHP to 7.3
- deprecated some getters and setters of BookControl and BookPage
- made BookPage::$slug and BookPage::$title writable
Version 2.1.1
- re-added support for Latte 2.5
......
......@@ -5,8 +5,8 @@ namespace Nexendrie\BookComponent;
/**
* @author Jakub Konečný
* @property-read string $slug
* @property-read string $title
* @property string $slug
* @property string $title
* @property-read bool $allowed
*/
class BookPage {
......@@ -30,12 +30,20 @@ class BookPage {
return $this->slug;
}
protected function setSlug(string $slug): void {
$this->slug = $slug;
}
/**
* @deprecated Access the property directly
*/
public function getTitle(): string {
return $this->title;
}
protected function setTitle(string $title): void {
$this->title = $title;
}
/**
* @param mixed $parameter
......
......@@ -22,13 +22,15 @@ final class BookPageTest extends \Tester\TestCase {
}
public function testSlug() {
Assert::type("string", $this->page->slug);
Assert::same("slug", $this->page->slug);
$this->page->slug = "abc";
Assert::same("abc", $this->page->slug);
}
public function testTitle() {
Assert::type("string", $this->page->title);
Assert::same("title", $this->page->title);
$this->page->title = "abc";
Assert::same("abc", $this->page->title);
}
public function testConditions() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment