for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* ActiveRecord for API
*
* @link https://github.com/hiqdev/yii2-hiart
* @package yii2-hiart
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/
namespace hiqdev\hiart\tests\unit;
use hiqdev\hiart\rest\Connection;
* Connection test class.
class ConnectionTest extends \PHPUnit_Framework_TestCase
{
protected $shortUri = 'http://api.dev';
protected $fixedUri = 'http://api.dev/';
protected function setUp()
$this->db = new Connection();
db
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;
}
protected function tearDown()
public function testShortBaseUri()
$this->db->baseUri = $this->shortUri;
$this->assertSame($this->fixedUri, $this->db->getBaseUri());
public function testFixedBaseUri()
$this->db->baseUri = $this->fixedUri;
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: