Fixed tests

This commit is contained in:
Graham Campbell
2015-06-01 22:25:34 +01:00
parent 0c065ae690
commit 049b9ac308
4 changed files with 26 additions and 292 deletions

View File

@@ -37,8 +37,8 @@
"barryvdh/laravel-cors": "^0.5" "barryvdh/laravel-cors": "^0.5"
}, },
"require-dev": { "require-dev": {
"graham-campbell/testbench": "^2.1", "phpunit/phpunit": "^4.6",
"fzaninotto/faker": "^1.4" "fzaninotto/faker": "^1.5"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [

277
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", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "fa3b8e90ee2bd0521b3b6553e79bd5b1", "hash": "6dac0c84f42d7cff9d4ef20d70eaa156",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@@ -3488,281 +3488,6 @@
], ],
"time": "2015-05-29 06:29:14" "time": "2015-05-29 06:29:14"
}, },
{
"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",
"source": {
"type": "git",
"url": "https://github.com/hamcrest/hamcrest-php.git",
"reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c",
"reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"replace": {
"cordoval/hamcrest-php": "*",
"davedevelopment/hamcrest-php": "*",
"kodova/hamcrest-php": "*"
},
"require-dev": {
"phpunit/php-file-iterator": "1.3.3",
"satooshi/php-coveralls": "dev-master"
},
"type": "library",
"autoload": {
"classmap": [
"hamcrest"
],
"files": [
"hamcrest/Hamcrest.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD"
],
"description": "This is the PHP port of Hamcrest Matchers",
"keywords": [
"test"
],
"time": "2015-05-11 14:41:42"
},
{
"name": "mockery/mockery",
"version": "0.9.4",
"source": {
"type": "git",
"url": "https://github.com/padraic/mockery.git",
"reference": "70bba85e4aabc9449626651f48b9018ede04f86b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/padraic/mockery/zipball/70bba85e4aabc9449626651f48b9018ede04f86b",
"reference": "70bba85e4aabc9449626651f48b9018ede04f86b",
"shasum": ""
},
"require": {
"hamcrest/hamcrest-php": "~1.1",
"lib-pcre": ">=7.0",
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.9.x-dev"
}
},
"autoload": {
"psr-0": {
"Mockery": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Pádraic Brady",
"email": "padraic.brady@gmail.com",
"homepage": "http://blog.astrumfutura.com"
},
{
"name": "Dave Marshall",
"email": "dave.marshall@atstsolutions.co.uk",
"homepage": "http://davedevelopment.co.uk"
}
],
"description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
"homepage": "http://github.com/padraic/mockery",
"keywords": [
"BDD",
"TDD",
"library",
"mock",
"mock objects",
"mockery",
"stub",
"test",
"test double",
"testing"
],
"time": "2015-04-02 19:54:00"
},
{
"name": "orchestra/database",
"version": "v3.1.0-BETA1",
"source": {
"type": "git",
"url": "https://github.com/orchestral/database.git",
"reference": "ec22a038e0975dac7ace9ea17bfca6133823cebc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/orchestral/database/zipball/ec22a038e0975dac7ace9ea17bfca6133823cebc",
"reference": "ec22a038e0975dac7ace9ea17bfca6133823cebc",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.1.*",
"illuminate/database": "5.1.*",
"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:04:23"
},
{
"name": "orchestra/testbench",
"version": "3.1.x-dev",
"source": {
"type": "git",
"url": "https://github.com/orchestral/testbench.git",
"reference": "b07d8bf1ae629e20e566a5d93f7c7fd88246ef45"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/orchestral/testbench/zipball/b07d8bf1ae629e20e566a5d93f7c7fd88246ef45",
"reference": "b07d8bf1ae629e20e566a5d93f7c7fd88246ef45",
"shasum": ""
},
"require": {
"laravel/framework": "5.1.*",
"orchestra/database": "3.1.*",
"php": ">=5.5.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.2-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-06-01 11:19:08"
},
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-docblock",
"version": "2.0.4", "version": "2.0.4",

View File

@@ -11,19 +11,28 @@
namespace CachetHQ\Tests\Cachet; namespace CachetHQ\Tests\Cachet;
use GrahamCampbell\TestBench\AbstractAppTestCase; use Illuminate\Foundation\Testing\TestCase;
abstract class AbstractTestCase extends AbstractAppTestCase abstract class AbstractTestCase extends TestCase
{ {
/** /**
* Get the service provider class. * The base URL to use while testing the application.
* *
* @param \Illuminate\Contracts\Foundation\Application $app * @var string
*
* @return string
*/ */
protected function getServiceProviderClass($app) protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{ {
return 'CachetHQ\Cachet\Providers\AppServiceProvider'; $app = require __DIR__.'/../bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
return $app;
} }
} }

View File

@@ -21,18 +21,18 @@ class ComponentTest extends AbstractTestCase
public function testGetComponents() public function testGetComponents()
{ {
$this->get('/api/v1/components')->seeJson(['data' => []]); $this->get('/api/v1/components')->seeJson(['data' => []]);
$this->assertResponseOk();
} }
/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function testGetInvalidComponent() public function testGetInvalidComponent()
{ {
$this->get('/api/v1/components/1'); $this->get('/api/v1/components/1');
$this->assertResponseStatus(404);
} }
/*public function testPostComponentUnauthorized() public function testPostComponentUnauthorized()
{ {
$this->post('/api/v1/components')->seeJson(['data']); $this->post('/api/v1/components');
}*/ $this->assertResponseStatus(401);
}
} }