category = new WikiCategory(); } #[\PHPUnit\Framework\Attributes\Group('module')] #[\PHPUnit\Framework\Attributes\TestDox('The model has the expected default values after initialization')] 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); } #[\PHPUnit\Framework\Attributes\Group('module')] #[\PHPUnit\Framework\Attributes\TestDox('The application can correctly set and returned')] public function testAppInputOutput() : void { $this->category->app = new NullWikiApp(2); self::assertEquals(2, $this->category->app->id); } #[\PHPUnit\Framework\Attributes\Group('module')] #[\PHPUnit\Framework\Attributes\TestDox('The name can correctly set and returned')] 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()); } #[\PHPUnit\Framework\Attributes\Group('module')] #[\PHPUnit\Framework\Attributes\TestDox('The path can correctly set and returned')] public function testPathInputOutput() : void { $this->category->virtualPath = '/test/path'; self::assertEquals('/test/path', $this->category->virtualPath); } #[\PHPUnit\Framework\Attributes\Group('module')] #[\PHPUnit\Framework\Attributes\TestDox('The parent can correctly set and returned')] public function testParentInputOutput() : void { $this->category->parent = new NullWikiCategory(2); self::assertEquals(2, $this->category->parent->id); } #[\PHPUnit\Framework\Attributes\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 ); } }