Skip to content

Commit

Permalink
[8.x] Adding tests to ValidatePostSize (#38332)
Browse files Browse the repository at this point in the history
* Update ResourceTest.php

* Update ResourceTest.php

* Update ResourceTest.php

* Revert "Update ResourceTest.php"

This reverts commit 8b6bace.

* Update ResourceTest.php

* Update ResourceTest.php
  • Loading branch information
komen205 authored Aug 11, 2021
1 parent ede6ee6 commit 7bd68fa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Integration/Http/ResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Illuminate\Tests\Integration\Http;

use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Http\Exceptions\PostTooLargeException;
use Illuminate\Http\Resources\ConditionallyLoadsAttributes;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Resources\MergeValue;
Expand Down Expand Up @@ -29,6 +31,7 @@
use Illuminate\Tests\Integration\Http\Fixtures\ResourceWithPreservedKeys;
use Illuminate\Tests\Integration\Http\Fixtures\SerializablePostResource;
use Illuminate\Tests\Integration\Http\Fixtures\Subscription;
use Mockery;
use Orchestra\Testbench\TestCase;

/**
Expand Down Expand Up @@ -989,6 +992,16 @@ public function work()
], $results);
}

public function testPostTooLargeException()
{
$this->expectException(PostTooLargeException::class);

$request = Mockery::mock(Request::class, ['server' => ['CONTENT_LENGTH' => '2147483640']]);
$post = new ValidatePostSize;
$post->handle($request, function () {
});
}

public function testLeadingMergeKeyedValueIsMergedCorrectlyWhenFirstValueIsMissing()
{
$filter = new class
Expand Down

0 comments on commit 7bd68fa

Please sign in to comment.