mirror of
https://github.com/composer/composer
synced 2025-05-10 00:53:06 +00:00
Fix schema minimum-stability pattern
This commit is contained in:
parent
251b852fd2
commit
8d8842eb8c
3 changed files with 16 additions and 18 deletions
|
@ -71,25 +71,23 @@ class ComposerSchemaTest extends TestCase
|
|||
|
||||
public function testMinimumStabilityValues()
|
||||
{
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "" }';
|
||||
$this->assertEquals(array(
|
||||
$expectedError = array(
|
||||
array(
|
||||
'property' => 'minimum-stability',
|
||||
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$',
|
||||
'constraint' => 'pattern',
|
||||
'pattern' => '^dev|alpha|beta|rc|RC|stable$',
|
||||
'message' => 'Does not have a value in the enumeration ["dev","alpha","beta","rc","RC","stable"]',
|
||||
'constraint' => 'enum',
|
||||
'enum' => array('dev', 'alpha', 'beta', 'rc', 'RC', 'stable'),
|
||||
),
|
||||
), $this->check($json), 'empty string');
|
||||
);
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "" }';
|
||||
$this->assertEquals($expectedError, $this->check($json), 'empty string');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dummy" }';
|
||||
$this->assertEquals(array(
|
||||
array(
|
||||
'property' => 'minimum-stability',
|
||||
'message' => 'Does not match the regex pattern ^dev|alpha|beta|rc|RC|stable$',
|
||||
'constraint' => 'pattern',
|
||||
'pattern' => '^dev|alpha|beta|rc|RC|stable$',
|
||||
),
|
||||
), $this->check($json), 'dummy');
|
||||
$this->assertEquals($expectedError, $this->check($json), 'dummy');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "devz" }';
|
||||
$this->assertEquals($expectedError, $this->check($json), 'devz');
|
||||
|
||||
$json = '{ "name": "vendor/package", "description": "generic description", "minimum-stability": "dev" }';
|
||||
$this->assertTrue($this->check($json), 'dev');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue