category = new WikiCategory(); } /** * @testdox The model has the expected default values after initialization * @covers \Modules\Knowledgebase\Models\WikiCategory * @group module */ public function testDefault() : void { self::assertEquals(0, $this->category->id); self::assertEquals(0, $this->category->app->id); self::assertEquals('', $this->category->getL11n()); self::assertEquals('/', $this->category->virtualPath); self::assertEquals(0, $this->category->parent->id); } /** * @testdox The application can correctly set and returned * @covers \Modules\Knowledgebase\Models\WikiCategory * @group module */ public function testAppInputOutput() : void { $this->category->app = new NullWikiApp(2); self::assertEquals(2, $this->category->app->id); } /** * @testdox The name can correctly set and returned * @covers \Modules\Knowledgebase\Models\WikiCategory * @group module */ public function testNameInputOutput() : void { $this->category->setL11n('Test'); self::assertEquals('Test', $this->category->getL11n()); $this->category->setL11n(new BaseStringL11n('NewTest')); self::assertEquals('NewTest', $this->category->getL11n()); } /** * @testdox The path can correctly set and returned * @covers \Modules\Knowledgebase\Models\WikiCategory * @group module */ public function testPathInputOutput() : void { $this->category->virtualPath = '/test/path'; self::assertEquals('/test/path', $this->category->virtualPath); } /** * @testdox The parent can correctly set and returned * @covers \Modules\Knowledgebase\Models\WikiCategory * @group module */ public function testParentInputOutput() : void { $this->category->parent = new NullWikiCategory(2); self::assertEquals(2, $this->category->parent->id); } /** * @covers \Modules\Knowledgebase\Models\WikiCategory * @group module */ public function testSerialize() : void { $this->category->app = new NullWikiApp(1); $this->category->virtualPath = '/test/path'; $serialized = $this->category->jsonSerialize(); self::assertEquals( [ 'id' => 0, 'app' => $this->category->app, 'virtualPath' => '/test/path', ], $serialized ); } }