<commit_before><?php

/**
 * This file is part of CodeIgniter 4 framework.
 *
 * (c) CodeIgniter Foundation <<EMAIL>>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace CodeIgniter\Publisher;

use CodeIgniter\Publisher\Exceptions\PublisherException;
use CodeIgniter\Test\CIUnitTestCase;

/**
 * Publisher Restrictions Test
 *
 * Tests that the restrictions defined in the configuration
 * file properly prevent disallowed actions.
 *
 * @internal
 */
final class PublisherRestrictionsTest extends CIUnitTestCase
{
    /**
     * @see Tests\Support\Config\Registrars::Publisher()
     */
    public function testRegistrarsNotAllowed()
    {
        $this->assertArrayNotHasKey(SUPPORTPATH, config('Publisher')->restrictions);
    }

    public function testImmutableRestrictions()
    {
        $publisher = new Publisher();

        // Try to "hack" the Publisher by adding our desired destination to the config
        config('Publisher')->restrictions[SUPPORTPATH] = '*';

        $restrictions = $this->getPrivateProperty($publisher, 'restrictions');

        $this->assertArrayNotHasKey(SUPPORTPATH, $restrictions);
    }<commit_msg>test: fix classname in comment<commit_after><?php

/**
 * This file is part of CodeIgniter 4 framework.
 *
 * (c) CodeIgniter Foundation <<EMAIL>>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace CodeIgniter\Publisher;

use CodeIgniter\Publisher\Exceptions\PublisherException;
use CodeIgniter\Test\CIUnitTestCase;

/**
 * Publisher Restrictions Test
 *
 * Tests that the restrictions defined in the configuration
 * file properly prevent disallowed actions.
 *
 * @internal
 */
final class PublisherRestrictionsTest extends CIUnitTestCase
{
    /**
     * @see \Tests\Support\Config\Registrar::Publisher()
     */
    public function testRegistrarsNotAllowed()
    {
        $this->assertArrayNotHasKey(SUPPORTPATH, config('Publisher')->restrictions);
    }

    public function testImmutableRestrictions()
    {
        $publisher = new Publisher();

        // Try to "hack" the Publisher by adding our desired destination to the config
        config('Publisher')->restrictions[SUPPORTPATH] = '*';

        $restrictions = $this->getPrivateProperty($publisher, 'restrictions');

        $this->assertArrayNotHasKey(SUPPORTPATH, $restrictions);
    }
{'fraction_non_alphanumeric': 0.10165389269866881, 'fraction_numerical': 0.0008067769261799112, 'mean_word_length': 3.84375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '2008766', 'n_tokens_mistral': 698, 'n_tokens_neox': 665, 'n_words': 188}