diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 9a63e07..566a48c 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -35,6 +35,11 @@ "foreignTable": "wiki_category", "foreignKey": "wiki_category_id" }, + "wiki_category_virtual": { + "name": "wiki_category_virtual", + "type": "VARCHAR(255)", + "null": false + }, "wiki_category_app": { "name": "wiki_category_app", "type": "INT", diff --git a/Admin/Installer.php b/Admin/Installer.php index 3cfc4fb..8f6d77d 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -43,7 +43,7 @@ final class Installer extends InstallerAbstract parent::install($dbPool, $info, $cfgHandler); $app = new WikiApp(); - $app->setName('Default'); + $app->name = 'Default'; $id = WikiAppMapper::create($app); @@ -57,7 +57,7 @@ final class Installer extends InstallerAbstract $units = UnitMapper::getAll(); foreach ($units as $unit) { $app = new WikiApp(); - $app->setName($unit->getName()); + $app->name = $unit->name; $id = WikiAppMapper::create($app); diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 56ffd9e..f0eb72d 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -65,14 +65,14 @@ final class ApiController extends Controller public function apiWikiDocCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateWikiDocCreate($request))) { - $response->set($request->getUri()->__toString(), new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->set($request->uri->__toString(), new FormValidation($val)); + $response->header->status = RequestStatusCode::R_400; return; } $doc = $this->createWikiDocFromRequest($request, $response, $data); - $this->createModel($request->getHeader()->getAccount(), $doc, WikiDocMapper::class, 'doc', $request->getOrigin()); + $this->createModel($request->header->account, $doc, WikiDocMapper::class, 'doc', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Wiki', 'Wiki successfully created.', $doc); } @@ -90,9 +90,9 @@ final class ApiController extends Controller public function createWikiDocFromRequest(RequestAbstract $request, ResponseAbstract $response, $data = null) : WikiDoc { $doc = new WikiDoc(); - $doc->setName((string) $request->getData('title')); - $doc->setDoc(Markdown::parse((string) ($request->getData('plain') ?? ''))); - $doc->setDocRaw((string) ($request->getData('plain') ?? '')); + $doc->name = (string) $request->getData('title'); + $doc->doc = Markdown::parse((string) ($request->getData('plain') ?? '')); + $doc->docRaw = (string) ($request->getData('plain') ?? ''); $doc->setCategory(new NullWikiCategory((int) ($request->getData('category') ?? 1))); $doc->setLanguage((string) ($request->getData('language') ?? $request->getLanguage())); $doc->setStatus((int) ($request->getData('status') ?? WikiStatus::INACTIVE)); @@ -107,7 +107,7 @@ final class ApiController extends Controller $internalResponse = new HttpResponse(); $this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse, $data); - $doc->addTag($internalResponse->get($request->getUri()->__toString())['response']); + $doc->addTag($internalResponse->get($request->uri->__toString())['response']); } else { $doc->addTag(new NullTag((int) $tag['id'])); } @@ -180,13 +180,13 @@ final class ApiController extends Controller { if (!empty($val = $this->validateWikiCategoryL11nCreate($request))) { $response->set('wiki_category_l11n_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $l11nWikiCategory = $this->createWikiCategoryL11nFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $l11nWikiCategory, WikiCategoryL11nMapper::class, 'wiki_category_l11n', $request->getOrigin()); + $this->createModel($request->header->account, $l11nWikiCategory, WikiCategoryL11nMapper::class, 'wiki_category_l11n', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Localization', 'Category localization successfully created', $l11nWikiCategory); } @@ -207,7 +207,7 @@ final class ApiController extends Controller $l11nWikiCategory->setLanguage((string) ( $request->getData('language') ?? $request->getLanguage() )); - $l11nWikiCategory->setName((string) ($request->getData('name') ?? '')); + $l11nWikiCategory->name = (string) ($request->getData('name') ?? ''); return $l11nWikiCategory; } @@ -248,7 +248,7 @@ final class ApiController extends Controller { $old = clone WikiDocMapper::get((int) $request->getData('id')); $new = $this->updateDocFromRequest($request); - $this->updateModel($request->getHeader()->getAccount(), $old, $new, WikiDocMapper::class, 'doc', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $new, WikiDocMapper::class, 'doc', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Doc', 'Doc successfully updated', $new); } @@ -285,7 +285,7 @@ final class ApiController extends Controller public function apiWikiDocDelete(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { $doc = WikiDocMapper::get((int) $request->getData('id')); - $this->deleteModel($request->getHeader()->getAccount(), $doc, WikiDocMapper::class, 'doc', $request->getOrigin()); + $this->deleteModel($request->header->account, $doc, WikiDocMapper::class, 'doc', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Doc', 'Doc successfully deleted', $doc); } @@ -305,22 +305,22 @@ final class ApiController extends Controller public function apiWikiCategoryCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateWikiCategoryCreate($request))) { - $response->set($request->getUri()->__toString(), new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->set($request->uri->__toString(), new FormValidation($val)); + $response->header->status = RequestStatusCode::R_400; return; } $category = $this->createWikiCategoryFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $category, WikiCategoryMapper::class, 'category', $request->getOrigin()); + $this->createModel($request->header->account, $category, WikiCategoryMapper::class, 'category', $request->getOrigin()); - $l11nRequest = new HttpRequest($request->getUri()); + $l11nRequest = new HttpRequest($request->uri); $l11nRequest->setData('category', $category->getId()); $l11nRequest->setData('name', $request->getData('name')); $l11nRequest->setData('language', $request->getData('language')); $l11nWikiCategory = $this->createWikiCategoryL11nFromRequest($l11nRequest); - $this->createModel($request->getHeader()->getAccount(), $l11nWikiCategory, WikiCategoryL11nMapper::class, 'tag_l11n', $request->getOrigin()); + $this->createModel($request->header->account, $l11nWikiCategory, WikiCategoryL11nMapper::class, 'tag_l11n', $request->getOrigin()); $category->setName($l11nWikiCategory); @@ -342,7 +342,7 @@ final class ApiController extends Controller $category->setApp(new NullWikiApp((int) ($request->getData('app') ?? 1))); if ($request->getData('parent') !== null) { - $category->setParent(new NullWikiCategory((int) $request->getData('parent'))); + $category->parent = new NullWikiCategory((int) $request->getData('parent')); } return $category; @@ -403,7 +403,7 @@ final class ApiController extends Controller { $old = clone WikiCategoryMapper::get((int) $request->getData('id')); $new = $this->updateCategoryFromRequest($request); - $this->updateModel($request->getHeader()->getAccount(), $old, $new, WikiCategoryMapper::class, 'category', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $new, WikiCategoryMapper::class, 'category', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Category', 'Category successfully updated', $new); } @@ -439,7 +439,7 @@ final class ApiController extends Controller public function apiWikiCategoryDelete(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { $category = WikiCategoryMapper::get((int) $request->getData('id')); - $this->deleteModel($request->getHeader()->getAccount(), $category, WikiCategoryMapper::class, 'category', $request->getOrigin()); + $this->deleteModel($request->header->account, $category, WikiCategoryMapper::class, 'category', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Category', 'Category successfully deleted', $category); } @@ -459,14 +459,14 @@ final class ApiController extends Controller public function apiWikiAppCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { if (!empty($val = $this->validateWikiAppCreate($request))) { - $response->set($request->getUri()->__toString(), new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->set($request->uri->__toString(), new FormValidation($val)); + $response->header->status = RequestStatusCode::R_400; return; } $app = $this->createWikiAppFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $app, WikiAppMapper::class, 'app', $request->getOrigin()); + $this->createModel($request->header->account, $app, WikiAppMapper::class, 'app', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'App', 'App successfully created.', $app); } @@ -482,7 +482,7 @@ final class ApiController extends Controller public function createWikiAppFromRequest(RequestAbstract $request) : WikiApp { $app = new WikiApp(); - $app->setName((string) $request->getData('name')); + $app->name = (string) $request->getData('name'); return $app; } @@ -542,7 +542,7 @@ final class ApiController extends Controller { $old = clone WikiAppMapper::get((int) $request->getData('id')); $new = $this->updateAppFromRequest($request); - $this->updateModel($request->getHeader()->getAccount(), $old, $new, WikiAppMapper::class, 'app', $request->getOrigin()); + $this->updateModel($request->header->account, $old, $new, WikiAppMapper::class, 'app', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'App', 'App successfully updated', $new); } @@ -579,7 +579,7 @@ final class ApiController extends Controller public function apiWikiAppDelete(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { $app = WikiAppMapper::get((int) $request->getData('id')); - $this->deleteModel($request->getHeader()->getAccount(), $app, WikiAppMapper::class, 'app', $request->getOrigin()); + $this->deleteModel($request->header->account, $app, WikiAppMapper::class, 'app', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'App', 'App successfully deleted', $app); } } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index ffac8b6..12f4351 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -287,13 +287,13 @@ final class BackendController extends Controller $lang = $response->getLanguage(); $document = WikiDocMapper::withConditional('language', $lang)::get((int) $request->getData('id')); - $accountId = $request->getHeader()->getAccount(); + $accountId = $request->header->account; if (!$this->app->accountManager->get($accountId)->hasPermission( PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::WIKI, $document->getId()) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; return $view; } diff --git a/Models/WikiApp.php b/Models/WikiApp.php index 26aea03..c35de83 100755 --- a/Models/WikiApp.php +++ b/Models/WikiApp.php @@ -38,7 +38,7 @@ class WikiApp implements \JsonSerializable * @var string * @since 1.0.0 */ - protected string $name = ''; + public string $name = ''; /** * Get id. @@ -52,32 +52,6 @@ class WikiApp implements \JsonSerializable return $this->id; } - /** - * Set the name. - * - * @param string $name Name of the app - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get the app name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - /** * {@inheritdoc} */ diff --git a/Models/WikiCategory.php b/Models/WikiCategory.php index 5c1ac14..fbcca70 100755 --- a/Models/WikiCategory.php +++ b/Models/WikiCategory.php @@ -58,7 +58,15 @@ class WikiCategory implements \JsonSerializable * @var self * @since 1.0.0 */ - private ?self $parent = null; + public self $parent; + + /** + * Path for organizing. + * + * @var string + * @since 1.0.0 + */ + private string $virtualPath = '/'; /** * Cosntructor @@ -68,6 +76,7 @@ class WikiCategory implements \JsonSerializable public function __construct() { $this->app = new NullWikiApp(); + $this->parent = new NullWikiCategory(); } /** @@ -134,38 +143,38 @@ class WikiCategory implements \JsonSerializable if ($name instanceof WikiCategoryL11n) { $this->name = $name; } elseif ($this->name instanceof WikiCategoryL11n && \is_string($name)) { - $this->name->setName($name); + $this->name->name = $name; } elseif (\is_string($name)) { $this->name = new WikiCategoryL11n(); - $this->name->setName($name); + $this->name->name = $name; $this->name->setLanguage($lang); } } /** - * Get parent category + * Get the path * - * @return self + * @return string * * @since 1.0.0 */ - public function getParent() : self + public function getVirtualPath() : string { - return $this->parent ?? new NullWikiCategory(); + return $this->virtualPath; } /** - * Set parent category + * Set the path if file * - * @param null|self $parent Parent category + * @param string $path Path to file * - * @return void + * @return mixed * * @since 1.0.0 */ - public function setParent(?self $parent) : void + public function setVirtualPath(string $path) { - $this->parent = $parent; + $this->virtualPath = $path; } /** diff --git a/Models/WikiCategoryL11n.php b/Models/WikiCategoryL11n.php index afc3d7d..f1da13d 100644 --- a/Models/WikiCategoryL11n.php +++ b/Models/WikiCategoryL11n.php @@ -57,7 +57,7 @@ class WikiCategoryL11n implements \JsonSerializable, ArrayableInterface * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Constructor. @@ -148,20 +148,6 @@ class WikiCategoryL11n implements \JsonSerializable, ArrayableInterface return $this->name; } - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - /** * {@inheritdoc} */ diff --git a/Models/WikiCategoryMapper.php b/Models/WikiCategoryMapper.php index 99c131e..267a0bc 100755 --- a/Models/WikiCategoryMapper.php +++ b/Models/WikiCategoryMapper.php @@ -36,6 +36,7 @@ final class WikiCategoryMapper extends DataMapperAbstract protected static array $columns = [ 'wiki_category_id' => ['name' => 'wiki_category_id', 'type' => 'int', 'internal' => 'id'], 'wiki_category_app' => ['name' => 'wiki_category_app', 'type' => 'int', 'internal' => 'app'], + 'wiki_category_virtual' => ['name' => 'wiki_category_virtual', 'type' => 'string', 'internal' => 'virtualPath'], 'wiki_category_parent' => ['name' => 'wiki_category_parent', 'type' => 'int', 'internal' => 'parent'], ]; diff --git a/Models/WikiDoc.php b/Models/WikiDoc.php index c1f5713..415415f 100755 --- a/Models/WikiDoc.php +++ b/Models/WikiDoc.php @@ -50,7 +50,7 @@ class WikiDoc implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Article status. @@ -66,7 +66,7 @@ class WikiDoc implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $doc = ''; + public string $doc = ''; /** * Document raw content. @@ -74,7 +74,7 @@ class WikiDoc implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $docRaw = ''; + public string $docRaw = ''; /** * Category. @@ -164,84 +164,6 @@ class WikiDoc implements \JsonSerializable $this->language = $language; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get content - * - * @return string - * - * @since 1.0.0 - */ - public function getDoc() : string - { - return $this->doc; - } - - /** - * Set content - * - * @param string $doc Document content - * - * @return void - * - * @since 1.0.0 - */ - public function setDoc(string $doc) : void - { - $this->doc = $doc; - } - - /** - * Get content - * - * @return string - * - * @since 1.0.0 - */ - public function getDocRaw() : string - { - return $this->docRaw; - } - - /** - * Set content - * - * @param string $doc Document content - * - * @return void - * - * @since 1.0.0 - */ - public function setDocRaw(string $doc) : void - { - $this->docRaw = $doc; - } - /** * Get status * diff --git a/Theme/Backend/wiki-category-list.tpl.php b/Theme/Backend/wiki-category-list.tpl.php index 635ed63..32488ba 100755 --- a/Theme/Backend/wiki-category-list.tpl.php +++ b/Theme/Backend/wiki-category-list.tpl.php @@ -35,8 +35,8 @@ echo $this->getData('nav')->render(); $url = UriFactory::build('{/prefix}admin/account/settings?{?}&id=' . $value->getId()); ?> printHtml($value->getId()); ?> - printHtml($value->getName()); ?> - printHtml($value->getParent() !== null ? $value->getParent()->getName() : ''); ?> + printHtml($value->name); ?> + printHtml($value->parent !== null ? $value->parent->getName() : ''); ?> getHtml('Empty', '0', '0'); ?> diff --git a/Theme/Backend/wiki-dashboard.tpl.php b/Theme/Backend/wiki-dashboard.tpl.php index ae80d0c..9af8689 100755 --- a/Theme/Backend/wiki-dashboard.tpl.php +++ b/Theme/Backend/wiki-dashboard.tpl.php @@ -32,10 +32,10 @@ echo $this->getData('nav')->render(); ?> getId()); ?>
- +
- getDocRaw(), 0, 500)); ?> + docRaw, 0, 500)); ?>
@@ -59,7 +59,7 @@ echo $this->getData('nav')->render(); ?>
diff --git a/Theme/Backend/wiki-doc-single.tpl.php b/Theme/Backend/wiki-doc-single.tpl.php index 68229d1..8b11abb 100755 --- a/Theme/Backend/wiki-doc-single.tpl.php +++ b/Theme/Backend/wiki-doc-single.tpl.php @@ -37,9 +37,9 @@ echo $this->getData('nav')->render();
-
printHtml($doc->getName()); ?>
+
printHtml($doc->name); ?>
-
getDoc(); ?>
+
doc; ?>
diff --git a/tests/Models/WikiAppMapperTest.php b/tests/Models/WikiAppMapperTest.php index fc906ee..0e9bf6e 100755 --- a/tests/Models/WikiAppMapperTest.php +++ b/tests/Models/WikiAppMapperTest.php @@ -34,14 +34,14 @@ class WikiAppMapperTest extends \PHPUnit\Framework\TestCase { $app = new WikiApp(); - $app->setName('Test Category'); + $app->name = 'Test Category'; $id = WikiAppMapper::create($app); self::assertGreaterThan(0, $app->getId()); self::assertEquals($id, $app->getId()); $appR = WikiAppMapper::get($app->getId()); - self::assertEquals($app->getName(), $appR->getName()); + self::assertEquals($app->name, $appR->name); } /** @@ -55,7 +55,7 @@ class WikiAppMapperTest extends \PHPUnit\Framework\TestCase $text = new Text(); $app = new WikiApp(); - $app->setName($text->generateText(\mt_rand(1, 3))); + $app->name = $text->generateText(\mt_rand(1, 3)); $id = WikiAppMapper::create($app); } diff --git a/tests/Models/WikiAppTest.php b/tests/Models/WikiAppTest.php index 77a1914..b72d40c 100755 --- a/tests/Models/WikiAppTest.php +++ b/tests/Models/WikiAppTest.php @@ -38,7 +38,7 @@ class WikiAppTest extends \PHPUnit\Framework\TestCase public function testDefault() : void { self::assertEquals(0, $this->app->getId()); - self::assertEquals('', $this->app->getName()); + self::assertEquals('', $this->app->name); } /** @@ -48,7 +48,7 @@ class WikiAppTest extends \PHPUnit\Framework\TestCase */ public function testNameInputOutput() : void { - $this->app->setName('Test name'); - self::assertEquals('Test name', $this->app->getName()); + $this->app->name = 'Test name'; + self::assertEquals('Test name', $this->app->name); } } diff --git a/tests/Models/WikiCategoryMapperTest.php b/tests/Models/WikiCategoryMapperTest.php index 5b12fa7..2346d1d 100755 --- a/tests/Models/WikiCategoryMapperTest.php +++ b/tests/Models/WikiCategoryMapperTest.php @@ -58,7 +58,7 @@ class WikiCategoryMapperTest extends \PHPUnit\Framework\TestCase public function testChildCR() : void { $this->category->setName('Test Category2'); - $this->category->setParent(new NullWikiCategory(1)); + $this->category->parent = new NullWikiCategory(1); $id = WikiCategoryMapper::create($this->category); self::assertGreaterThan(0, $this->category->getId()); @@ -66,7 +66,7 @@ class WikiCategoryMapperTest extends \PHPUnit\Framework\TestCase $categoryR = WikiCategoryMapper::get($this->category->getId()); self::assertEquals($this->category->getName(), $categoryR->getName()); - self::assertEquals($this->category->getParent()->getId(), $categoryR->getParent()->getId()); + self::assertEquals($this->category->parent->getId(), $categoryR->parent->getId()); } /** diff --git a/tests/Models/WikiCategoryTest.php b/tests/Models/WikiCategoryTest.php index 2f5e222..3db1353 100755 --- a/tests/Models/WikiCategoryTest.php +++ b/tests/Models/WikiCategoryTest.php @@ -42,8 +42,8 @@ class WikiCategoryTest extends \PHPUnit\Framework\TestCase self::assertEquals(0, $this->category->getId()); self::assertEquals(0, $this->category->getApp()->getId()); self::assertEquals('', $this->category->getName()); - self::assertEquals('/', $this->category->getPath()); - self::assertEquals(0, $this->category->getParent()->getId()); + self::assertEquals('/', $this->category->getVirtualPath()); + self::assertEquals(0, $this->category->parent->getId()); } /** @@ -75,8 +75,8 @@ class WikiCategoryTest extends \PHPUnit\Framework\TestCase */ public function testPathInputOutput() : void { - $this->category->setPath('/test/path'); - self::assertEquals('/test/path', $this->category->getPath()); + $this->category->setVirtualPath('/test/path'); + self::assertEquals('/test/path', $this->category->getVirtualPath()); } /** @@ -86,7 +86,7 @@ class WikiCategoryTest extends \PHPUnit\Framework\TestCase */ public function testParentInputOutput() : void { - $this->category->setParent(new NullWikiCategory(2)); - self::assertEquals(2, $this->category->getParent()->getId()); + $this->category->parent = new NullWikiCategory(2); + self::assertEquals(2, $this->category->parent->getId()); } } diff --git a/tests/Models/WikiDocMapperTest.php b/tests/Models/WikiDocMapperTest.php index 173ba7b..0f1d525 100755 --- a/tests/Models/WikiDocMapperTest.php +++ b/tests/Models/WikiDocMapperTest.php @@ -36,8 +36,8 @@ class WikiDocMapperTest extends \PHPUnit\Framework\TestCase { $doc = new WikiDoc(); - $doc->setName('Doc Name'); - $doc->setDoc('Doc content'); + $doc->name = 'Doc Name'; + $doc->doc = 'Doc content'; $doc->setStatus(WikiStatus::DRAFT); $doc->setCategory(new NullWikiCategory(1)); $doc->setLanguage('en'); @@ -47,8 +47,8 @@ class WikiDocMapperTest extends \PHPUnit\Framework\TestCase self::assertEquals($id, $doc->getId()); $docR = WikiDocMapper::get($doc->getId()); - self::assertEquals($doc->getName(), $docR->getName()); - self::assertEquals($doc->getDoc(), $docR->getDoc()); + self::assertEquals($doc->name, $docR->name); + self::assertEquals($doc->doc, $docR->doc); self::assertEquals($doc->getStatus(), $docR->getStatus()); self::assertEquals($doc->getLanguage(), $docR->getLanguage()); self::assertEquals($doc->getCategory()->getId(), $docR->getCategory()->getId()); @@ -65,8 +65,8 @@ class WikiDocMapperTest extends \PHPUnit\Framework\TestCase $text = new Text(); $doc = new WikiDoc(); - $doc->setName($text->generateText(\mt_rand(1, 3))); - $doc->setDoc($text->generateText(\mt_rand(100, 500))); + $doc->name = $text->generateText(\mt_rand(1, 3)); + $doc->doc = $text->generateText(\mt_rand(100, 500)); $doc->setStatus(WikiStatus::ACTIVE); $doc->setCategory(new NullWikiCategory(\mt_rand(1, 9))); $doc->setLanguage('en'); diff --git a/tests/Models/WikiDocTest.php b/tests/Models/WikiDocTest.php index 0d04ab4..861f7b5 100755 --- a/tests/Models/WikiDocTest.php +++ b/tests/Models/WikiDocTest.php @@ -43,9 +43,9 @@ class WikiDocTest extends \PHPUnit\Framework\TestCase { self::assertEquals(0, $this->doc->getId()); self::assertEquals(0, $this->doc->getApp()->getId()); - self::assertEquals('', $this->doc->getName()); - self::assertEquals('', $this->doc->getDoc()); - self::assertEquals('', $this->doc->getDocRaw()); + self::assertEquals('', $this->doc->name); + self::assertEquals('', $this->doc->doc); + self::assertEquals('', $this->doc->docRaw); self::assertEquals(WikiStatus::ACTIVE, $this->doc->getStatus()); self::assertEquals(0, $this->doc->getCategory()->getId()); self::assertEquals('en', $this->doc->getLanguage()); @@ -70,8 +70,8 @@ class WikiDocTest extends \PHPUnit\Framework\TestCase */ public function testNameInputOutput() : void { - $this->doc->setName('Test name'); - self::assertEquals('Test name', $this->doc->getName()); + $this->doc->name = 'Test name'; + self::assertEquals('Test name', $this->doc->name); } /** @@ -81,8 +81,8 @@ class WikiDocTest extends \PHPUnit\Framework\TestCase */ public function testDocInputOutput() : void { - $this->doc->setDoc('Test content'); - self::assertEquals('Test content', $this->doc->getDoc()); + $this->doc->doc = 'Test content'; + self::assertEquals('Test content', $this->doc->doc); } /** @@ -92,8 +92,8 @@ class WikiDocTest extends \PHPUnit\Framework\TestCase */ public function testDocRawInputOutput() : void { - $this->doc->setDocRaw('Test content'); - self::assertEquals('Test content', $this->doc->getDocRaw()); + $this->doc->docRaw = 'Test content'; + self::assertEquals('Test content', $this->doc->docRaw); } /**