Skip to content

Commit

Permalink
Remove remaining required references from Form\Schema.
Browse files Browse the repository at this point in the history
The requiredness of a field comes from the field having a validation
rule.
  • Loading branch information
markstory committed Dec 20, 2014
1 parent ffd5d89 commit 278a40b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/Form/Schema.php
Expand Up @@ -35,7 +35,6 @@ class Schema {
'type' => null,
'length' => null,
'precision' => null,
'required' => false,
];

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Form/SchemaTest.php
Expand Up @@ -51,15 +51,15 @@ public function testAddingFields() {

$this->assertEquals(['name'], $schema->fields());
$res = $schema->field('name');
$expected = ['type' => 'string', 'length' => null, 'required' => false];
$expected = ['type' => 'string', 'length' => null, 'precision' => null];
$this->assertEquals($expected, $res);

$res = $schema->addField('email', 'string');
$this->assertSame($schema, $res, 'Should be chainable');

$this->assertEquals(['name', 'email'], $schema->fields());
$res = $schema->field('email');
$expected = ['type' => 'string', 'length' => null, 'required' => false];
$expected = ['type' => 'string', 'length' => null, 'precision' => null];
$this->assertEquals($expected, $res);
}

Expand All @@ -72,7 +72,7 @@ public function testAddingFieldsWhitelist() {
$schema = new Schema();

$schema->addField('name', ['derp' => 'derp', 'type' => 'string']);
$expected = ['type' => 'string', 'length' => null, 'required' => false];
$expected = ['type' => 'string', 'length' => null, 'precision' => null];
$this->assertEquals($expected, $schema->field('name'));
}

Expand Down

0 comments on commit 278a40b

Please sign in to comment.