for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LaravelFr\ApiTesting\Tests\AssertJsonResponse;
use Illuminate\Http\Response;
use PHPUnit_Framework_TestCase;
use LaravelFr\ApiTesting\AssertJsonResponse;
use Laravel\BrowserKitTesting\Concerns\MakesHttpRequests;
use LaravelFr\ApiTesting\Tests\Stubs\JsonSerializableMixedResourcesStub;
class AssertJsonResponseForOldVersionAndBrowserKitTest extends PHPUnit_Framework_TestCase
{
use AssertJsonResponse, MakesHttpRequests;
public function setUp()
$this->stub = new JsonSerializableMixedResourcesStub;
stub
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->response = new Response($this->stub);
}
public function testSeeJsonStructureEquals()
$this->assertJsonStructureEquals($this->stub->structure());
public function testJsonResponse()
$this->assertEquals(
['foobar_foo' => 'foo', 'foobar_bar' => 212],
$this->jsonResponse('foobar')
);
$this->assertEquals(212, $this->jsonResponse('foobar.foobar_bar'));
public function testSeeJsonTypedStructure()
$this->seeJsonTypedStructure($this->stub->typedStructure());
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: