[Schema] Drop SDK-only name pattern on resources and resource templates (#430)
* [Schema] Drop SDK-only name pattern on resources and resource templates * Update src/Schema/ResourceDefinition.php * Update src/Schema/ResourceTemplate.php
This commit is contained in:
parent
6f58fe596a
commit
d5351759d7
1 changed files with 49 additions and 16 deletions
|
|
@ -116,6 +116,30 @@ class ResourceDefinitionTest extends TestCase
|
|||
$this->assertArrayNotHasKey('title', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The specification puts no pattern on `name`; its own examples use
|
||||
* names such as "main.rs" and "Project Files".
|
||||
*/
|
||||
#[DataProvider('provideSpecExampleNames')]
|
||||
public function testConstructorAcceptsAnyName(string $name): void
|
||||
{
|
||||
$resource = new ResourceDefinition(
|
||||
uri: self::VALID_URI,
|
||||
name: $name,
|
||||
);
|
||||
|
||||
$this->assertSame($name, $resource->name);
|
||||
}
|
||||
|
||||
public static function provideSpecExampleNames(): iterable
|
||||
{
|
||||
yield 'file name with dot' => ['main.rs'];
|
||||
yield 'display name with space' => ['Project Files'];
|
||||
yield 'uppercase file name' => ['README.md'];
|
||||
yield 'namespaced' => ['acme/reports:quarterly'];
|
||||
yield 'unicode' => ['Ünïcödé 名前'];
|
||||
}
|
||||
|
||||
#[DataProvider('provideInvalidResources')]
|
||||
public function testFromArrayInvalid(array $input, string $expectedExceptionMessage): void
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue