Skip to content

Commit

Permalink
Revert test
Browse files Browse the repository at this point in the history
  • Loading branch information
ttsuru committed Aug 7, 2018
1 parent 8af6002 commit 29dfb4e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
13 changes: 12 additions & 1 deletion tests/Foundation/FoundationFormRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ public function test_validated_method_returns_the_validated_data()
}

public function test_validated_method_returns_the_validated_data_nested_rules()
{
$payload = ['nested' => ['foo' => 'bar', 'baz' => ''], 'array' => [1, 2]];

$request = $this->createRequest($payload, FoundationTestFormRequestNestedStub::class);

$request->validateResolved();

$this->assertEquals(['nested' => ['foo' => 'bar'], 'array' => [1, 2]], $request->validated());
}

public function test_validated_method_returns_the_validated_data_nested()
{
$payload = ['nested' => ['foo' => 'bar', 'with' => 'extras']];

Expand All @@ -45,7 +56,7 @@ public function test_validated_method_returns_the_validated_data_nested_rules()
$this->assertEquals(['nested' => ['foo' => 'bar']], $request->validated());
}

public function test_validated_method_returns_the_validated_data_nested_array_rules()
public function test_validated_method_returns_the_validated_data_nested_array()
{
$payload = ['nested' => [['bar' => 'baz', 'with' => 'extras'], ['bar' => 'baz2', 'with' => 'extras']]];

Expand Down
17 changes: 16 additions & 1 deletion tests/Validation/ValidationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4006,6 +4006,21 @@ public function testValidateReturnsValidatedData()
}

public function testValidateReturnsValidatedDataNestedRules()
{
$post = ['nested' => ['foo' => 'bar', 'baz' => ''], 'array' => [1, 2]];

$rules = ['nested.foo' => 'required', 'array.*' => 'integer'];

$v = new Validator($this->getIlluminateArrayTranslator(), $post, $rules);
$v->sometimes('type', 'required', function () {
return false;
});
$data = $v->validate();

$this->assertEquals(['nested' => ['foo' => 'bar'], 'array' => [1, 2]], $data);
}

public function testValidateReturnsValidatedDataNested()
{
$post = ['nested' => ['foo' => 'bar', 'with' => 'extras', 'type' => 'admin']];

Expand All @@ -4018,7 +4033,7 @@ public function testValidateReturnsValidatedDataNestedRules()
$this->assertEquals(['nested' => ['foo' => 'bar']], $data);
}

public function testValidateReturnsValidatedDataNestedArrayRules()
public function testValidateReturnsValidatedDataNestedArray()
{
$post = ['nested' => [['bar' => 'baz', 'with' => 'extras', 'type' => 'admin'], ['bar' => 'baz2', 'with' => 'extras', 'type' => 'admin']]];

Expand Down

0 comments on commit 29dfb4e

Please sign in to comment.