- Timestamp:
- 03/23/2026 07:39:45 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/abilities-api/wpAbilitiesRegistry.php
r61602 r62094 138 138 139 139 /** 140 * Should accept ability name with 3 segments (2 slashes).141 *142 * @ticket 64098143 *144 * @covers WP_Abilities_Registry::register145 */146 public function test_register_valid_name_with_three_segments() {147 $result = $this->registry->register( 'test/sub/add-numbers', self::$test_ability_args );148 $this->assertInstanceOf( WP_Ability::class, $result );149 $this->assertSame( 'test/sub/add-numbers', $result->get_name() );150 }151 152 /**153 * Should accept ability name with 4 segments (3 slashes).154 *155 * @ticket 64098156 *157 * @covers WP_Abilities_Registry::register158 */159 public function test_register_valid_name_with_four_segments() {160 $result = $this->registry->register( 'test/sub/deep/add-numbers', self::$test_ability_args );161 $this->assertInstanceOf( WP_Ability::class, $result );162 $this->assertSame( 'test/sub/deep/add-numbers', $result->get_name() );163 }164 165 /**166 * Should reject ability name with 5 segments (exceeds maximum of 4).167 *168 * @ticket 64098169 *170 * @covers WP_Abilities_Registry::register171 *172 * @expectedIncorrectUsage WP_Abilities_Registry::register173 */174 public function test_register_invalid_name_with_five_segments() {175 $result = $this->registry->register( 'test/a/b/c/too-deep', self::$test_ability_args );176 $this->assertNull( $result );177 }178 179 /**180 * Should reject ability name with empty segments (double slashes).181 *182 * @ticket 64098183 *184 * @covers WP_Abilities_Registry::register185 *186 * @expectedIncorrectUsage WP_Abilities_Registry::register187 */188 public function test_register_invalid_name_with_empty_segment() {189 $result = $this->registry->register( 'test//add-numbers', self::$test_ability_args );190 $this->assertNull( $result );191 }192 193 /**194 * Should reject ability name with trailing slash.195 *196 * @ticket 64098197 *198 * @covers WP_Abilities_Registry::register199 *200 * @expectedIncorrectUsage WP_Abilities_Registry::register201 */202 public function test_register_invalid_name_with_trailing_slash() {203 $result = $this->registry->register( 'test/add-numbers/', self::$test_ability_args );204 $this->assertNull( $result );205 }206 207 /**208 140 * Should reject ability registration without a label. 209 141 *
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)