<commit_before><?php

namespace SilverStripe\CMS\Tests\Controllers;

use Page;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Admin\CMSBatchActionHandler;
use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\CSSContentParser;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned;

class CMSMainTest extends FunctionalTest
{
    protected static $fixture_file = 'CMSMainTest.yml';

    static protected $orig = array();

    public function setUp()
    {
        parent::setUp();

        // Clear automatically created siteconfigs (in case one was created outside of the specified fixtures).
        $ids = $this->allFixtureIDs(SiteConfig::class);
        if ($ids) {
            foreach (SiteConfig::get()->exclude('ID', $ids) as $config) {
                $config->delete();
            }
        }
    }

    public function testSiteTreeHints()
    {
        $cache = Injector::inst()->get(CacheInterface::class . '.CMSMain_SiteTreeHints');
        // Login as user with root creation privileges
        $user = $this->objFromFixture(Member::class, 'rootedituser');
        Security::setCurrentUser($user);
        $cache->clear();

        $rawHints = singleton(CMSMain::class)->SiteTreeHints();
        $this->assertNotNull($rawHints);<commit_msg>MINOR: Fix linting error<commit_after><?php

namespace SilverStripe\CMS\Tests\Controllers;

use Page;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Admin\CMSBatchActionHandler;
use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\CSSContentParser;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned;

class CMSMainTest extends FunctionalTest
{
    protected static $fixture_file = 'CMSMainTest.yml';

    protected static $orig = array();

    public function setUp()
    {
        parent::setUp();

        // Clear automatically created siteconfigs (in case one was created outside of the specified fixtures).
        $ids = $this->allFixtureIDs(SiteConfig::class);
        if ($ids) {
            foreach (SiteConfig::get()->exclude('ID', $ids) as $config) {
                $config->delete();
            }
        }
    }

    public function testSiteTreeHints()
    {
        $cache = Injector::inst()->get(CacheInterface::class . '.CMSMain_SiteTreeHints');
        // Login as user with root creation privileges
        $user = $this->objFromFixture(Member::class, 'rootedituser');
        Security::setCurrentUser($user);
        $cache->clear();

        $rawHints = singleton(CMSMain::class)->SiteTreeHints();
        $this->assertNotNull($rawHints);
{'fraction_non_alphanumeric': 0.11352859135285913, 'fraction_numerical': 0.0, 'mean_word_length': 3.9944289693593316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4769152', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1093, 'n_words': 214}