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

@@ -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());
}
}