<commit_before><?php

declare(strict_types=1);

namespace Tests\Feature\Platform;

use Orchid\Platform\Models\User;
use Orchid\Tests\TestFeatureCase;

class AnnouncementTest extends TestFeatureCase
{
    /**
     * @var User
     */
    private $user;

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

        $this->user = factory(User::class)->create();
    }

    public function test_open_screen()
    {
        $response = $this
            ->actingAs($this->user)
            ->get(route('platform.systems.announcement'));

        $response->assertStatus(200);
    }

    private function test_create_announcement($text = 'Global Announcement Test')
    {
        $response = $this
            ->actingAs($this->user)
            ->post(route('platform.systems.announcement', ['saveOrUpdate']), [
                'announcement' => [
                    'content' => $text,
                ],
            ]);

        $response->assertStatus(302);

        $response = $this
            ->actingAs($this->user)
            ->get(route('platform.main'));

        $this->assertContains($text, $response->getContent());
    }

    public function test_rewrite_announcement()
    {
        $this->test_create_announcement();
        $this->test_create_announcement('Global Announcement Test Rewrite');
    }


    public function test_delete_announcement($text = 'Delete Announcement')
    {
        $this->test_create_announcement($text);

        $this
            ->actingAs($this->user)
            ->post(route('platform.systems.announcement', ['disabled']));

        $response = $this
            ->actingAs($this->user)
            ->get(route('platform.main'));

        $this->assertNotContains($text, $response->getContent());
    }

}<commit_msg>fixed test Announcement<commit_after><?php

declare(strict_types=1);

namespace Tests\Feature\Platform;

use Orchid\Platform\Models\User;
use Orchid\Tests\TestFeatureCase;

class AnnouncementTest extends TestFeatureCase
{
    /**
     * @var User
     */
    private $user;

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

        $this->user = factory(User::class)->create();
    }

    public function test_open_screen()
    {
        $response = $this
            ->actingAs($this->user)
            ->get(route('platform.systems.announcement'));

        $response->assertStatus(200);
    }

    private function createAnnouncement($text = 'Global Announcement Test')
    {
        $response = $this
            ->actingAs($this->user)
            ->post(route('platform.systems.announcement', ['saveOrUpdate']), [
                'announcement' => [
                    'content' => $text,
                ],
            ]);

        $response->assertStatus(302);

        $response = $this
            ->actingAs($this->user)
            ->get(route('platform.main'));

        $this->assertContains($text, $response->getContent());
    }

    public function test_rewrite_announcement()
    {
        $this->createAnnouncement();
        $this->createAnnouncement('Global Announcement Test Rewrite');
    }


    public function test_delete_announcement($text = 'Delete Announcement')
    {
        $this->createAnnouncement($text);

        $this
            ->actingAs($this->user)
            ->post(route('platform.systems.announcement', ['disabled']));

        $response = $this
            ->actingAs($this->user)
            ->get(route('platform.main'));

        $this->assertNotContains($text, $response->getContent());
    }

}
{'fraction_non_alphanumeric': 0.14988814317673377, 'fraction_numerical': 0.0039149888143176735, 'mean_word_length': 2.2023276633840645, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, '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': '242549', 'n_tokens_mistral': 1065, 'n_tokens_neox': 999, 'n_words': 152}