45 lines
1.0 KiB
PHP
45 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 test_push_and_pop(): 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 test_deprecation_can_be_expected(): 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);
|
|
}
|
|
}
|