for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
*
* @filesource ClassLoaderTraitTest.php
* @created 29.02.2016
* @package chillerlan\DatabaseTest\Traits
* @author Smiley <[email protected]>
* @copyright 2015 Smiley
* @license MIT
*/
namespace chillerlan\DatabaseTest\Traits;
use chillerlan\Database\DBOptions;
use chillerlan\Database\Drivers\DBDriverInterface;
use chillerlan\Database\Drivers\MySQLi\MySQLiDriver;
use chillerlan\Database\Traits\ClassLoaderTrait;
class ClassLoaderTraitTest extends \PHPUnit_Framework_TestCase{
use ClassLoaderTrait;
public function testClassLoaderSuccess(){
$dbdriver = $this->__loadClass(MySQLiDriver::class, DBDriverInterface::class, new DBOptions);
$this->assertInstanceOf(DBDriverInterface::class, $dbdriver);
}
* @expectedException \chillerlan\Database\DBException
* @expectedExceptionMessage chillerlan\Database\Drivers\MySQLi\MySQLiDriver does not implement chillerlan\DatabaseTest\Traits\TestInterface
public function testClassLoaderDoesNotImplementException(){
$this->__loadClass(MySQLiDriver::class, TestInterface::class);
* @expectedExceptionMessage Interface whatevs does not exist
public function testClassLoaderDoesNotExistException(){
$this->__loadClass(MySQLiDriver::class, 'whatevs');