designModeDemo/Tests/StackTest.php

18 lines
450 B
PHP

<?php
declare(strict_types=1);
class StackTest extends \PHPUnit\Framework\TestCase
{
public function testPushAndPop(): void
{
$stack = [];
$this->assertSame(0, count($stack));
$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));
}
}