PHP code example of subtlephp / bran
1. Go to this page and download the library: Download subtlephp/bran library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
subtlephp / bran example snippets
use Bran\Raven;
class RavenTest extends Raven
{
protected $clientConfig = [
'base_uri' => 'http://gank.io',
];
protected $apiConfig = [
'images' => [
'pattern' => '/api/data/Android/10/1',
'method' => 'get',
],
];
public function testAssertStatusCode()
{
$entity = $this->call('images');
$entity->assertStatusCode(200)
->assertHeader('Content-Type', 'application/json')
->assertJsonBodyHas('error')
->assertJsonBodyAttributeEquals('error', false);
}
public function setUp()
{
parent::setUp();
$this->clientConfig['headers']['Cookie'] = $this->login();
}
public function login()
{
$entity = $this->call('login');
return $entity->cookie;
}
}