Added some very basic model tests

This commit is contained in:
Graham Campbell 2016-07-29 14:46:02 -04:00
parent b045028c7b
commit b7244b7987
15 changed files with 402 additions and 9 deletions

View File

@ -44,7 +44,7 @@
"roumen/feed": "^2.10.4"
},
"require-dev": {
"alt-three/testbench": "^1.7",
"alt-three/testbench": "^1.8",
"filp/whoops": "^2.1",
"fzaninotto/faker": "^1.6",
"graham-campbell/testbench-core": "^1.1",

16
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "bebdff554746dd7e0b24b4881e92191e",
"content-hash": "7c21d245d3c8c6f69ac1d98a58e4b761",
"hash": "efee15cdcec498c266017d8b6b9dc40b",
"content-hash": "5e0dba0b123506042e11f77f15280b6e",
"packages": [
{
"name": "alt-three/badger",
@ -4109,16 +4109,16 @@
"packages-dev": [
{
"name": "alt-three/testbench",
"version": "v1.7.0",
"version": "v1.8.1",
"source": {
"type": "git",
"url": "https://github.com/AltThree/TestBench.git",
"reference": "9bc6029a3a813dd20674548e45db5f6db0d1b4cd"
"reference": "35c6e02a36a14e6fb2084adf22922d78d04424af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AltThree/TestBench/zipball/9bc6029a3a813dd20674548e45db5f6db0d1b4cd",
"reference": "9bc6029a3a813dd20674548e45db5f6db0d1b4cd",
"url": "https://api.github.com/repos/AltThree/TestBench/zipball/35c6e02a36a14e6fb2084adf22922d78d04424af",
"reference": "35c6e02a36a14e6fb2084adf22922d78d04424af",
"shasum": ""
},
"require": {
@ -4136,7 +4136,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
"dev-master": "1.8-dev"
}
},
"autoload": {
@ -4168,7 +4168,7 @@
"TestBench",
"app"
],
"time": "2016-07-24 13:16:43"
"time": "2016-07-29 18:38:43"
},
{
"name": "doctrine/instantiator",

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the component group model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ComponentGroupTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new ComponentGroup());
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the component model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ComponentTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new Component());
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\IncidentTemplate;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the incident template model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class IncidentTemplateTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new IncidentTemplate());
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the incident model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class IncidentTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new Incident());
}
}

View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the invite model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class InviteTest extends AbstractTestCase
{
public function testValidation()
{
$this->assertFalse(property_exists(new Invite(), 'rules'));
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the metric point model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class MetricPointTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new MetricPoint());
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the metric model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class MetricTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new Metric());
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ExistenceTrait;
use PHPUnit_Framework_TestCase as TestCase;
/**
* This is the model existence test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ModelExistenceTest extends TestCase
{
use ExistenceTrait;
protected function getSourcePath()
{
return realpath(__DIR__.'/../../app/Models');
}
}

View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use CachetHQ\Cachet\Models\Setting;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the setting model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class SettingTest extends AbstractTestCase
{
public function testValidation()
{
$this->assertFalse(property_exists(new Setting(), 'rules'));
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\Subscriber;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the subscriber model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class SubscriberTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new Subscriber());
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\Subscription;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the subscription model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class SubscriptionTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new Subscription());
}
}

28
tests/Models/TagTest.php Normal file
View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use CachetHQ\Cachet\Models\Tag;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the tag model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class TagTest extends AbstractTestCase
{
public function testValidation()
{
$this->assertFalse(property_exists(new Tag(), 'rules'));
}
}

31
tests/Models/UserTest.php Normal file
View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of Cachet.
*
* (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\Models;
use AltThree\TestBench\ValidationTrait;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the user model test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class UserTest extends AbstractTestCase
{
use ValidationTrait;
public function testValidation()
{
$this->checkRules(new User());
}
}