Started working on a test suite

Signed-off-by: Graham Campbell <graham@cachethq.io>
This commit is contained in:
James Brooks
2015-05-28 18:18:33 +01:00
committed by Graham Campbell
parent c2b69ff547
commit 7b3f6fee26
8 changed files with 229 additions and 55 deletions

View File

@@ -38,6 +38,7 @@
"barryvdh/laravel-cors": "^0.5"
},
"require-dev": {
"graham-campbell/testbench": "^2.1",
"phpunit/phpunit": "^4.4",
"mockery/mockery": "^0.9"
},
@@ -53,9 +54,9 @@
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
"psr-4": {
"CachetHQ\\Tests\\Cachet\\": "tests/"
}
},
"scripts": {
"post-install-cmd": [

167
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "f84e1802797ac9d788fa551927e87a70",
"hash": "852749758f495fdc944891946fbdef85",
"packages": [
{
"name": "asm89/stack-cors",
@@ -3350,6 +3350,60 @@
],
"time": "2014-10-13 12:58:55"
},
{
"name": "graham-campbell/testbench",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/GrahamCampbell/Laravel-TestBench.git",
"reference": "deea0e8cb8f6ee9c4032c24a40365eb334617a60"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Laravel-TestBench/zipball/deea0e8cb8f6ee9c4032c24a40365eb334617a60",
"reference": "deea0e8cb8f6ee9c4032c24a40365eb334617a60",
"shasum": ""
},
"require": {
"mockery/mockery": "~0.9.4",
"orchestra/testbench": "3.0.*|3.1.*",
"php": ">=5.5.9",
"phpunit/phpunit": "~4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"autoload": {
"psr-4": {
"GrahamCampbell\\TestBench\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "graham@mineuk.com"
}
],
"description": "TestBench Provides Some Testing Functionality For Laravel 5",
"keywords": [
"Graham Campbell",
"GrahamCampbell",
"Laravel TestBench",
"Laravel-TestBench",
"TestBench",
"framework",
"laravel",
"testing"
],
"time": "2015-04-24 19:37:19"
},
{
"name": "hamcrest/hamcrest-php",
"version": "v1.2.2",
@@ -3460,6 +3514,117 @@
],
"time": "2015-04-02 19:54:00"
},
{
"name": "orchestra/database",
"version": "v3.0.4",
"source": {
"type": "git",
"url": "https://github.com/orchestral/database.git",
"reference": "0ad5e77155ae6443d228bf1174cf8dc426290738"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/orchestral/database/zipball/0ad5e77155ae6443d228bf1174cf8dc426290738",
"reference": "0ad5e77155ae6443d228bf1174cf8dc426290738",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.0.*",
"illuminate/database": "5.0.*",
"php": ">=5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Orchestra\\Database\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mior Muhammad Zaki",
"email": "crynobone@gmail.com",
"homepage": "https://github.com/crynobone"
},
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com",
"homepage": "https://github.com/taylorotwell"
}
],
"description": "Database Component for Orchestra Platform",
"time": "2015-03-02 11:01:05"
},
{
"name": "orchestra/testbench",
"version": "v3.0.7",
"source": {
"type": "git",
"url": "https://github.com/orchestral/testbench.git",
"reference": "468db68c6c96e67905156f507c431a9e387d43e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/orchestral/testbench/zipball/468db68c6c96e67905156f507c431a9e387d43e4",
"reference": "468db68c6c96e67905156f507c431a9e387d43e4",
"shasum": ""
},
"require": {
"laravel/framework": "5.0.*",
"orchestra/database": "3.0.*",
"php": ">=5.4.0"
},
"require-dev": {
"behat/behat": "~2.5",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"behat/behat": "Allow to use Behat for testing your Laravel Application/Package (~2.5).",
"phpunit/phpunit": "Allow to use PHPUnit for testing your Laravel Application/Package (~4.0)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Orchestra\\Testbench\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mior Muhammad Zaki",
"email": "crynobone@gmail.com",
"homepage": "https://github.com/crynobone"
}
],
"description": "Laravel Package Unit Testing Helper",
"homepage": "http://orchestraplatform.com/docs/latest/components/testbench/",
"keywords": [
"BDD",
"TDD",
"laravel",
"orchestra-platform",
"orchestral",
"testing"
],
"time": "2015-05-27 03:35:20"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.4",

View File

@@ -57,7 +57,7 @@ return [
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path().'/database.sqlite',
'database' => env('DB_HOST', storage_path().'/database.sqlite'),
'prefix' => '',
],

View File

@@ -26,6 +26,8 @@
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="DB_DRIVER" value="sqlite"/>
<env name="DB_HOST" value=":memory:"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="log"/>

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Tests\Cachet;
use GrahamCampbell\TestBench\AbstractAppTestCase;
abstract class AbstractTestCase extends AbstractAppTestCase
{
/**
* Get the service provider class.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return string
*/
protected function getServiceProviderClass($app)
{
return 'CachetHQ\Cachet\Providers\AppServiceProvider';
}
}

View File

@@ -1,23 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class ExampleTest extends TestCase
{
/**
* A basic functional test example.
*/
public function testBasicExample()
{
$true = true;
$this->assertTrue($true);
}
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Tests\Cachet\Functional;
use CachetHQ\Tests\Cachet\AbstractTestCase;
class CommandTest extends AbstractTestCase
{
public function testMigrations()
{
$this->assertSame(0, $this->getKernel()->call('migrate', ['--force' => true]));
}
protected function getKernel()
{
return $this->app->make('Illuminate\Contracts\Console\Kernel');
}
}

View File

@@ -1,27 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
return $app;
}
}