Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Dingo\Api\Tests\Http; use Dingo\Api\Http\Parser\Accept as AcceptParser; ..
Decoded Output download
<?php
namespace Dingo\Api\Tests\Http;
use Dingo\Api\Http\Parser\Accept as AcceptParser;
use Dingo\Api\Http\RequestValidator;
use Dingo\Api\Tests\BaseTestCase;
use Dingo\Api\Tests\Stubs\HttpValidatorStub;
use Illuminate\Container\Container;
use Illuminate\Http\Request;
class RequestValidatorTest extends BaseTestCase
{
/**
* @var Container
*/
protected $container;
/**
* @var RequestValidator
*/
protected $validator;
public function setUp(): void
{
$this->container = new Container;
$this->container->instance(AcceptParser::class, new AcceptParser('vnd', 'test', 'v1', 'json'));
$this->validator = new RequestValidator($this->container);
}
public function testValidationFailsWithNoValidators()
{
$this->validator->replace([]);
$this->assertFalse($this->validator->validateRequest(Request::create('foo', 'GET')), 'Validation passed when there were no validators.');
}
public function testValidationFails()
{
$this->validator->replace([HttpValidatorStub::class]);
$this->assertFalse($this->validator->validateRequest(Request::create('foo', 'GET')), 'Validation passed when given a GET request.');
}
public function testValidationPasses()
{
$this->validator->replace([HttpValidatorStub::class]);
$this->assertTrue($this->validator->validateRequest(Request::create('foo', 'POST')), 'Validation failed when given a POST request.');
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Dingo\Api\Tests\Http;
use Dingo\Api\Http\Parser\Accept as AcceptParser;
use Dingo\Api\Http\RequestValidator;
use Dingo\Api\Tests\BaseTestCase;
use Dingo\Api\Tests\Stubs\HttpValidatorStub;
use Illuminate\Container\Container;
use Illuminate\Http\Request;
class RequestValidatorTest extends BaseTestCase
{
/**
* @var Container
*/
protected $container;
/**
* @var RequestValidator
*/
protected $validator;
public function setUp(): void
{
$this->container = new Container;
$this->container->instance(AcceptParser::class, new AcceptParser('vnd', 'test', 'v1', 'json'));
$this->validator = new RequestValidator($this->container);
}
public function testValidationFailsWithNoValidators()
{
$this->validator->replace([]);
$this->assertFalse($this->validator->validateRequest(Request::create('foo', 'GET')), 'Validation passed when there were no validators.');
}
public function testValidationFails()
{
$this->validator->replace([HttpValidatorStub::class]);
$this->assertFalse($this->validator->validateRequest(Request::create('foo', 'GET')), 'Validation passed when given a GET request.');
}
public function testValidationPasses()
{
$this->validator->replace([HttpValidatorStub::class]);
$this->assertTrue($this->validator->validateRequest(Request::create('foo', 'POST')), 'Validation failed when given a POST request.');
}
}
Function Calls
None |
Stats
MD5 | 86020a720d548a8ff731b94fe00b3401 |
Eval Count | 0 |
Decode Time | 91 ms |