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

made BookPage::$slug and $title real properties

parent 15249ad8
Pipeline #186326447 passed with stage
in 54 seconds
......@@ -5,14 +5,12 @@ namespace Nexendrie\BookComponent;
/**
* @author Jakub Konečný
* @property string $slug
* @property string $title
* @property-read bool $allowed
*/
class BookPage {
use \Nette\SmartObject;
protected string $slug;
protected string $title;
public string $slug;
public string $title;
/** @var array of [IBookPageCondition, string] */
protected array $conditions = [];
......@@ -28,6 +26,9 @@ class BookPage {
return $this->slug;
}
/**
* @deprecated Access the property directly
*/
protected function setSlug(string $slug): void {
$this->slug = $slug;
}
......@@ -39,6 +40,9 @@ class BookPage {
return $this->title;
}
/**
* @deprecated Access the property directly
*/
protected function setTitle(string $title): void {
$this->title = $title;
}
......
......@@ -20,18 +20,6 @@ final class BookPageTest extends \Tester\TestCase {
$this->page = new BookPage("slug", "title");
}
public function testSlug() {
Assert::same("slug", $this->page->slug);
$this->page->slug = "abc";
Assert::same("abc", $this->page->slug);
}
public function testTitle() {
Assert::same("title", $this->page->title);
$this->page->title = "abc";
Assert::same("abc", $this->page->title);
}
public function testConditions() {
Assert::true($this->page->allowed);
$this->page->addCondition(new class() implements IBookPageCondition {
......
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