Cachet/tests/AbstractTestCase.php

51 lines
1020 B
PHP
Raw Normal View History

<?php
/*
* This file is part of Cachet.
*
2015-07-06 17:37:01 +01:00
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Tests\Cachet;
2015-06-24 20:16:40 +01:00
use CachetHQ\Cachet\Models\User;
use Illuminate\Contracts\Console\Kernel;
2015-06-01 22:25:34 +01:00
use Illuminate\Foundation\Testing\TestCase;
2015-06-01 22:25:34 +01:00
abstract class AbstractTestCase extends TestCase
{
/**
2015-06-01 22:25:34 +01:00
* The base URL to use while testing the application.
*
2015-06-01 22:25:34 +01:00
* @var string
*/
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
2015-06-01 22:25:34 +01:00
* @return \Illuminate\Foundation\Application
*/
2015-06-01 22:25:34 +01:00
public function createApplication()
{
2015-06-01 22:25:34 +01:00
$app = require __DIR__.'/../bootstrap/app.php';
2015-06-24 20:16:40 +01:00
$app->make(Kernel::class)->bootstrap();
2015-06-01 22:25:34 +01:00
return $app;
}
2015-06-02 13:42:39 +01:00
/**
2015-06-24 20:16:40 +01:00
* Become a user.
2015-06-02 13:42:39 +01:00
*/
protected function beUser()
{
2015-06-24 20:16:40 +01:00
$this->user = factory(User::class)->create();
2015-06-02 13:42:39 +01:00
$this->be($this->user);
}
}