Part-DB.Part-DB-server/tests/Services/LogSystem/EventCommentHelperTest.php

91 lines
3 KiB
PHP
Raw Permalink Normal View History

<?php
2022-11-29 21:21:26 +01:00
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2020-03-15 13:57:50 +01:00
declare(strict_types=1);
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Tests\Services\LogSystem;
use App\Services\LogSystem\EventCommentHelper;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class EventCommentHelperTest extends WebTestCase
{
/**
* @var EventCommentHelper
*/
protected $service;
protected function setUp(): void
{
2023-06-11 14:18:53 +02:00
// TODO: Change the autogenerated stub
2023-04-15 23:14:53 +02:00
//Get a service instance.
self::bootKernel();
2022-12-18 19:45:04 +01:00
$this->service = self::getContainer()->get(EventCommentHelper::class);
}
2020-03-15 13:57:50 +01:00
public function testInitialState(): void
{
$this->assertNull($this->service->getMessage());
$this->assertFalse($this->service->isMessageSet());
}
2020-03-15 13:57:50 +01:00
public function testClearMessage(): void
{
$this->service->setMessage('Test');
$this->assertTrue($this->service->isMessageSet());
$this->service->clearMessage();
$this->assertFalse($this->service->isMessageSet());
}
2020-03-15 13:57:50 +01:00
public function testGetSetMessage(): void
{
$this->service->setMessage('Test');
$this->assertSame('Test', $this->service->getMessage());
}
2020-03-15 13:57:50 +01:00
public function testIsMessageSet(): void
{
$this->service->setMessage('Test');
$this->assertTrue($this->service->isMessageSet());
$this->service->clearMessage();
$this->assertFalse($this->service->isMessageSet());
}
}