Skip to content

Commit

Permalink
Merge branch 'develop' into 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
claar committed Apr 18, 2016
2 parents 78ae8c6 + 8fc2d5e commit 37f6876
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Former/Traits/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function value($value)
// Check if we already have a value stored for this field or in POST data
$already = $this->repopulate();

if ($already === null) {
if (!$already) {
$this->value = $value;
}

Expand Down
16 changes: 2 additions & 14 deletions tests/Fields/HiddenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function testCanCreateHiddenField()
$this->assertHTML($field, $input);
}

public function testCanRepopulateHiddenFields()
public function testCanPopulateHiddenFields()
{
$this->former->populate(array('foo' => 'bar'));

Expand All @@ -26,19 +26,7 @@ public function testCanRepopulateHiddenFields()

$this->assertHTML($field, $input);
}

public function testCanRepopulateHiddenFieldsWithZero()
{
$this->former->populate(array('foo' => '0'));

$input = $this->former->hidden('foo')->value('bis')->__toString();
$matcher = $this->matchField(array(), 'hidden');
$field = array_except($matcher, 'id');
$field['attributes']['value'] = '0';

$this->assertHTML($field, $input);
}


public function testEncodedValue()
{
$input = $this->former->hidden('foo')->value('<a>bar</a>')->__toString();
Expand Down

0 comments on commit 37f6876

Please sign in to comment.