diff --git a/src/Cms/Role.php b/src/Cms/Role.php index 3579b623cc..ecdf2a6702 100644 --- a/src/Cms/Role.php +++ b/src/Cms/Role.php @@ -82,7 +82,11 @@ public function description(): string|null public static function factory(array $props, array $inject = []): static { - return new static($props + $inject); + // ensure to properly extend the blueprint + $props = $props + $inject; + $props = Blueprint::extend($props); + + return new static($props); } public function id(): string diff --git a/tests/Cms/Roles/RoleTest.php b/tests/Cms/Roles/RoleTest.php index 9ffc6ed96a..45499c63a8 100644 --- a/tests/Cms/Roles/RoleTest.php +++ b/tests/Cms/Roles/RoleTest.php @@ -35,6 +35,7 @@ public function testFactory() $this->assertSame('editor', $role->name()); $this->assertSame('Editor', $role->title()); + $this->assertSame('This should be inherited', $role->description()); } public function testMissingRole() diff --git a/tests/Cms/Roles/RolesTest.php b/tests/Cms/Roles/RolesTest.php index ef619cb37c..f51ec9856b 100644 --- a/tests/Cms/Roles/RolesTest.php +++ b/tests/Cms/Roles/RolesTest.php @@ -32,8 +32,9 @@ public function testLoad() $this->assertInstanceOf(Roles::class, $roles); - // should contain the editor role from fixtures and the default admin role - $this->assertCount(2, $roles); + // should contain the base and editor role from fixtures + // and the default admin role + $this->assertCount(3, $roles); $this->assertSame('admin', $roles->first()->name()); $this->assertSame('editor', $roles->last()->name()); } diff --git a/tests/Cms/Roles/fixtures/blueprints/users/base.yml b/tests/Cms/Roles/fixtures/blueprints/users/base.yml new file mode 100644 index 0000000000..4998517c5e --- /dev/null +++ b/tests/Cms/Roles/fixtures/blueprints/users/base.yml @@ -0,0 +1 @@ +description: This should be inherited diff --git a/tests/Cms/Roles/fixtures/blueprints/users/editor.yml b/tests/Cms/Roles/fixtures/blueprints/users/editor.yml index 8f9d8bd616..a9dcb6ec9e 100644 --- a/tests/Cms/Roles/fixtures/blueprints/users/editor.yml +++ b/tests/Cms/Roles/fixtures/blueprints/users/editor.yml @@ -1 +1,3 @@ title: Editor + +extends: users/base