Passed
Push — master ( 301f96...5c3d68 )
by Robbie
05:48
created

tests/php/Controllers/CMSMainTest_ClassA.php (2 issues)

Severity
1
<?php
2
3
namespace SilverStripe\CMS\Tests\Controllers;
4
5
use SilverStripe\CMS\Model\SiteTree;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\ORM\ValidationException;
8
9
class CMSMainTest_ClassA extends SiteTree implements TestOnly
10
{
11
    private static $table_name = 'CMSMainTest_ClassA';
0 ignored issues
show
The private property $table_name is not used, and could be removed.
Loading history...
12
13
    private static $allowed_children = [CMSMainTest_ClassB::class];
0 ignored issues
show
The private property $allowed_children is not used, and could be removed.
Loading history...
14
15
    protected function onBeforeWrite()
16
    {
17
        parent::onBeforeWrite();
18
19
        if ($this->ClassName !== self::class) {
20
            throw new ValidationException("Class saved with incorrect ClassName");
21
        }
22
    }
23
}
24