2014-05-14 23:24:20 +10:00
|
|
|
<?php
|
|
|
|
|
2015-02-09 21:51:26 +11:00
|
|
|
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
2014-05-14 23:24:20 +10:00
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates the application.
|
|
|
|
*
|
2015-02-09 21:51:26 +11:00
|
|
|
* @return \Illuminate\Foundation\Application
|
2014-05-14 23:24:20 +10:00
|
|
|
*/
|
|
|
|
public function createApplication()
|
|
|
|
{
|
2015-02-09 21:51:26 +11:00
|
|
|
$app = require __DIR__.'/../bootstrap/app.php';
|
|
|
|
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
2014-05-14 23:24:20 +10:00
|
|
|
|
2015-02-10 17:45:27 +11:00
|
|
|
$app['cache']->setDefaultDriver('array');
|
2015-02-09 21:51:26 +11:00
|
|
|
$app->setLocale('en');
|
2014-05-14 23:24:20 +10:00
|
|
|
|
2015-02-09 21:51:26 +11:00
|
|
|
return $app;
|
2014-05-14 23:24:20 +10:00
|
|
|
}
|
|
|
|
|
2019-02-19 20:11:43 +03:00
|
|
|
//
|
|
|
|
// Helpers
|
|
|
|
//
|
|
|
|
|
|
|
|
protected static function callProtectedMethod($object, $name, $params = [])
|
|
|
|
{
|
|
|
|
$className = get_class($object);
|
|
|
|
$class = new ReflectionClass($className);
|
|
|
|
$method = $class->getMethod($name);
|
|
|
|
$method->setAccessible(true);
|
|
|
|
return $method->invokeArgs($object, $params);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getProtectedProperty($object, $name)
|
|
|
|
{
|
|
|
|
$className = get_class($object);
|
|
|
|
$class = new ReflectionClass($className);
|
|
|
|
$property = $class->getProperty($name);
|
|
|
|
$property->setAccessible(true);
|
|
|
|
return $property->getValue($object);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function setProtectedProperty($object, $name, $value)
|
|
|
|
{
|
|
|
|
$className = get_class($object);
|
|
|
|
$class = new ReflectionClass($className);
|
|
|
|
$property = $class->getProperty($name);
|
|
|
|
$property->setAccessible(true);
|
|
|
|
return $property->setValue($object, $value);
|
|
|
|
}
|
2014-05-14 23:24:20 +10:00
|
|
|
}
|