Teren-app/tests/Unit/ExampleTest.php
2025-03-25 21:38:24 +01:00

46 lines
1.0 KiB
PHP

<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): string
{
$this->assertTrue(false);
return 'first';
}
public function testPushAndPop(): void
{
$stack = [];
$this->assertSame(0, count($stack));
array_push($stack, 'foo');
$this->assertSame('foo', $stack[count($stack)-1]);
$this->assertSame(1, count($stack));
$this->assertSame('foo', array_pop($stack));
$this->assertSame(0, count($stack));
}
public function testDeprecationCanBeExpected(): void
{
$this->expectDeprecation();
// Optionally test that the message is equal to a string
$this->expectDeprecationMessage('foo');
// Or optionally test that the message matches a regular expression
$this->expectDeprecationMessageMatches('/foo/');
\trigger_error('foo', \E_USER_DEPRECATED);
}
}