‪TYPO3CMS  ‪main
PublicMethodDeprecationTraitTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
24 final class ‪PublicMethodDeprecationTraitTest extends UnitTestCase
25 {
26  #[Test]
27  public function ‪publicMethodCanBeCalled(): void
28  {
29  $this->expectException(\RuntimeException::class);
30  $this->expectExceptionCode(1528822131);
31  (new ‪PublicMethodDeprecationTraitTextFixture())->standardPublicMethod();
32  }
33 
34  #[Test]
36  {
37  $this->expectException(\Error::class);
38  (new ‪PublicMethodDeprecationTraitTextFixture())->standardProtectedMethod();
39  }
40 
41  #[Test]
42  public function ‪notExistingMethodThrowsError(): void
43  {
44  $this->expectException(\Error::class);
45  (new ‪PublicMethodDeprecationTraitTextFixture())->doesNotExist();
46  }
47 
48  #[Test]
49  public function ‪methodMadeProtectedCanBeCalled(): void
50  {
51  $this->expectException(\RuntimeException::class);
52  $this->expectExceptionCode(1528822485);
53  (new ‪PublicMethodDeprecationTraitTextFixture())->methodMadeProtected();
54  }
55 
56  #[Test]
57  public function ‪methodMadeProtectedReturnsValue(): void
58  {
59  self::assertEquals('foo', (new ‪PublicMethodDeprecationTraitTextFixture())->methodMadeProtectedWithReturn());
60  }
61 
62  #[Test]
64  {
65  $this->expectException(\RuntimeException::class);
66  $this->expectExceptionCode(1528822486);
67  (new ‪PublicMethodDeprecationTraitTextFixture())->methodMadeProtectedWithArguments('foo', 'bar');
68  }
69 }
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\Fixtures\PublicMethodDeprecationTraitTextFixture
Definition: PublicMethodDeprecationTraitTextFixture.php:26
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest\publicMethodCanBeCalled
‪publicMethodCanBeCalled()
Definition: PublicMethodDeprecationTraitTest.php:27
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest\methodMadeProtectedReturnsValue
‪methodMadeProtectedReturnsValue()
Definition: PublicMethodDeprecationTraitTest.php:57
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest\methodMadeProtectedCanBeCalled
‪methodMadeProtectedCanBeCalled()
Definition: PublicMethodDeprecationTraitTest.php:49
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest\protectedMethodNotHandledByTraitThrowsError
‪protectedMethodNotHandledByTraitThrowsError()
Definition: PublicMethodDeprecationTraitTest.php:35
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest
Definition: PublicMethodDeprecationTraitTest.php:25
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest\notExistingMethodThrowsError
‪notExistingMethodThrowsError()
Definition: PublicMethodDeprecationTraitTest.php:42
‪TYPO3\CMS\Core\Tests\UnitDeprecated\Compatibility\PublicMethodDeprecationTraitTest\methodMadeProtectedCanBeCalledWithArguments
‪methodMadeProtectedCanBeCalledWithArguments()
Definition: PublicMethodDeprecationTraitTest.php:63