Skip to content

Commit 02e4464

Browse files
Merge pull request #2017 from CachetHQ/tests
Added some very basic model tests
2 parents b045028 + b7244b7 commit 02e4464

15 files changed

+402
-9
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"roumen/feed": "^2.10.4"
4545
},
4646
"require-dev": {
47-
"alt-three/testbench": "^1.7",
47+
"alt-three/testbench": "^1.8",
4848
"filp/whoops": "^2.1",
4949
"fzaninotto/faker": "^1.6",
5050
"graham-campbell/testbench-core": "^1.1",

composer.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Models/ComponentGroupTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\ComponentGroup;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the component group model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class ComponentGroupTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new ComponentGroup());
30+
}
31+
}

tests/Models/ComponentTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\Component;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the component model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class ComponentTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new Component());
30+
}
31+
}

tests/Models/IncidentTemplateTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\IncidentTemplate;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the incident template model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class IncidentTemplateTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new IncidentTemplate());
30+
}
31+
}

tests/Models/IncidentTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\Incident;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the incident model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class IncidentTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new Incident());
30+
}
31+
}

tests/Models/InviteTest.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use CachetHQ\Cachet\Models\Invite;
15+
use CachetHQ\Tests\Cachet\AbstractTestCase;
16+
17+
/**
18+
* This is the invite model test class.
19+
*
20+
* @author Graham Campbell <graham@alt-three.com>
21+
*/
22+
class InviteTest extends AbstractTestCase
23+
{
24+
public function testValidation()
25+
{
26+
$this->assertFalse(property_exists(new Invite(), 'rules'));
27+
}
28+
}

tests/Models/MetricPointTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\MetricPoint;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the metric point model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class MetricPointTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new MetricPoint());
30+
}
31+
}

tests/Models/MetricTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\Metric;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the metric model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class MetricTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new Metric());
30+
}
31+
}

tests/Models/ModelExistenceTest.php

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ExistenceTrait;
15+
use PHPUnit_Framework_TestCase as TestCase;
16+
17+
/**
18+
* This is the model existence test class.
19+
*
20+
* @author Graham Campbell <graham@alt-three.com>
21+
*/
22+
class ModelExistenceTest extends TestCase
23+
{
24+
use ExistenceTrait;
25+
26+
protected function getSourcePath()
27+
{
28+
return realpath(__DIR__.'/../../app/Models');
29+
}
30+
}

tests/Models/SettingTest.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use CachetHQ\Cachet\Models\Setting;
15+
use CachetHQ\Tests\Cachet\AbstractTestCase;
16+
17+
/**
18+
* This is the setting model test class.
19+
*
20+
* @author Graham Campbell <graham@alt-three.com>
21+
*/
22+
class SettingTest extends AbstractTestCase
23+
{
24+
public function testValidation()
25+
{
26+
$this->assertFalse(property_exists(new Setting(), 'rules'));
27+
}
28+
}

tests/Models/SubscriberTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Cachet.
5+
*
6+
* (c) Alt Three Services Limited
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace CachetHQ\Tests\Cachet\Models;
13+
14+
use AltThree\TestBench\ValidationTrait;
15+
use CachetHQ\Cachet\Models\Subscriber;
16+
use CachetHQ\Tests\Cachet\AbstractTestCase;
17+
18+
/**
19+
* This is the subscriber model test class.
20+
*
21+
* @author Graham Campbell <graham@alt-three.com>
22+
*/
23+
class SubscriberTest extends AbstractTestCase
24+
{
25+
use ValidationTrait;
26+
27+
public function testValidation()
28+
{
29+
$this->checkRules(new Subscriber());
30+
}
31+
}

0 commit comments

Comments
 (0)