for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Mezon\Gui\Tests\Simple;
use Mezon\Gui\ListBuilder;
use Mezon\Gui\Tests\FakeAdapter;
use Mezon\Gui\Tests\ListBuilderTestsBase;
/**
*
* @psalm-suppress PropertyNotSetInConstructor
*/
class NoItemsCreateButtonUnitTest extends ListBuilderTestsBase
{
* Testing data provider
* @return array testing data
public function actionsDataProvider(): array
return [
// #0, the first case - without button
[
function (): object {
// setup
unset($_GET['create-button']);
return new ListBuilder\Simple($this->getFields(), new FakeAdapter([]));
}
],
// #1, the second case - without button, even if we try to display it
$_GET['create-button'] = 1;
];
* Testing create button absence
* @param callable $setup
* setup method
* @dataProvider actionsDataProvider
public function testCreateButtonAbsenceForEmptyList(callable $setup): void
$obj = $setup();
// test body
$result = $obj->listingForm();
// assertions
$this->assertStringNotContainsString('create-button"', $result);