mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Fix notices reported by latest PHPUnit version
This commit is contained in:
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace ShlinkioTest\Shlink\CLI\Util;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionObject;
|
||||
use Shlinkio\Shlink\CLI\Util\ShlinkTable;
|
||||
@@ -15,15 +14,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ShlinkTableTest extends TestCase
|
||||
{
|
||||
private ShlinkTable $shlinkTable;
|
||||
private MockObject & Table $baseTable;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->baseTable = $this->createMock(Table::class);
|
||||
$this->shlinkTable = ShlinkTable::fromBaseTable($this->baseTable);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function renderMakesTableToBeRenderedWithProvidedInfo(): void
|
||||
{
|
||||
@@ -32,22 +22,23 @@ class ShlinkTableTest extends TestCase
|
||||
$headerTitle = 'Header';
|
||||
$footerTitle = 'Footer';
|
||||
|
||||
$this->baseTable->expects($this->once())->method('setStyle')->with(
|
||||
$baseTable = $this->createMock(Table::class);
|
||||
$baseTable->expects($this->once())->method('setStyle')->with(
|
||||
$this->isInstanceOf(TableStyle::class),
|
||||
)->willReturnSelf();
|
||||
$this->baseTable->expects($this->once())->method('setHeaders')->with($headers)->willReturnSelf();
|
||||
$this->baseTable->expects($this->once())->method('setRows')->with($rows)->willReturnSelf();
|
||||
$this->baseTable->expects($this->once())->method('setFooterTitle')->with($footerTitle)->willReturnSelf();
|
||||
$this->baseTable->expects($this->once())->method('setHeaderTitle')->with($headerTitle)->willReturnSelf();
|
||||
$this->baseTable->expects($this->once())->method('render')->with()->willReturnSelf();
|
||||
$baseTable->expects($this->once())->method('setHeaders')->with($headers)->willReturnSelf();
|
||||
$baseTable->expects($this->once())->method('setRows')->with($rows)->willReturnSelf();
|
||||
$baseTable->expects($this->once())->method('setFooterTitle')->with($footerTitle)->willReturnSelf();
|
||||
$baseTable->expects($this->once())->method('setHeaderTitle')->with($headerTitle)->willReturnSelf();
|
||||
$baseTable->expects($this->once())->method('render')->with()->willReturnSelf();
|
||||
|
||||
$this->shlinkTable->render($headers, $rows, $footerTitle, $headerTitle);
|
||||
ShlinkTable::fromBaseTable($baseTable)->render($headers, $rows, $footerTitle, $headerTitle);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function newTableIsCreatedForFactoryMethod(): void
|
||||
{
|
||||
$instance = ShlinkTable::default($this->createMock(OutputInterface::class));
|
||||
$instance = ShlinkTable::default($this->createStub(OutputInterface::class));
|
||||
|
||||
$ref = new ReflectionObject($instance);
|
||||
$baseTable = $ref->getProperty('baseTable');
|
||||
|
||||
Reference in New Issue
Block a user