Add tests for Taggable model
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use AltThree\TestBench\ValidationTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class Taggable extends Model
|
||||
{
|
||||
use ValidationTrait;
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
@@ -43,6 +46,17 @@ class Taggable extends Model
|
||||
'taggable_type',
|
||||
];
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'tag_id' => 'required|int',
|
||||
'taggable_id' => 'required|int',
|
||||
'taggable_type' => 'required|string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the tag relation.
|
||||
*
|
||||
|
||||
31
tests/Models/TaggableTest.php
Normal file
31
tests/Models/TaggableTest.php
Normal 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\Taggable;
|
||||
use CachetHQ\Tests\Cachet\AbstractTestCase;
|
||||
|
||||
/**
|
||||
* This is the taggable model test class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class TaggableTest extends AbstractTestCase
|
||||
{
|
||||
use ValidationTrait;
|
||||
|
||||
public function testValidation()
|
||||
{
|
||||
$this->checkRules(new Taggable());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user