Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
DDEV User authored and koertho committed Mar 1, 2024
1 parent 1b63e0e commit 1c480b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/EventListener/DcaField/DateAddedFieldListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Contao\DataContainer;
use Contao\Model;
use HeimrichHannot\UtilsBundle\Dca\DateAddedField;
use HeimrichHannot\UtilsBundle\Dca\DcaFieldConfiguration;
use HeimrichHannot\UtilsBundle\EventListener\DcaField\DateAddedFieldListener;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;

class DateAddedFieldListenerTest extends TestCase
{
Expand All @@ -16,7 +16,9 @@ class DateAddedFieldListenerTest extends TestCase
*/
public function testOnLoadDataContainer()
{
$listener = new DateAddedFieldListener();
$container = $this->createMock(ContainerInterface::class);

$listener = new DateAddedFieldListener($container);
$table = 'test_table';

// Mock the global array
Expand Down Expand Up @@ -45,6 +47,7 @@ public function testOnLoadCallback()
// Without DataContainer

$listener = $this->getMockBuilder(DateAddedFieldListener::class)
->setConstructorArgs([$this->createMock(ContainerInterface::class)])
->onlyMethods(['getModelInstance'])
->getMock();

Expand All @@ -55,6 +58,7 @@ public function testOnLoadCallback()
// With DataContainer, but no model instance

$listener = $this->getMockBuilder(DateAddedFieldListener::class)
->setConstructorArgs([$this->createMock(ContainerInterface::class)])
->onlyMethods(['getModelInstance'])
->getMock();

Expand All @@ -80,6 +84,7 @@ public function testOnLoadCallback()
// Complete run

$listener = $this->getMockBuilder(DateAddedFieldListener::class)
->setConstructorArgs([$this->createMock(ContainerInterface::class)])
->onlyMethods(['getModelInstance'])
->getMock();

Expand All @@ -100,6 +105,7 @@ public function testOnLoadCallback()
public function testOnCopyCallback()
{
$listener = $this->getMockBuilder(DateAddedFieldListener::class)
->setConstructorArgs([$this->createMock(ContainerInterface::class)])
->onlyMethods(['getModelInstance'])
->getMock();

Expand Down Expand Up @@ -135,6 +141,7 @@ public function testOnCopyCallback()
});

$listener = $this->getMockBuilder(DateAddedFieldListener::class)
->setConstructorArgs([$this->createMock(ContainerInterface::class)])
->onlyMethods(['getModelInstance'])
->getMock();

Expand All @@ -145,6 +152,7 @@ public function testOnCopyCallback()
// Complete run

$listener = $this->getMockBuilder(DateAddedFieldListener::class)
->setConstructorArgs([$this->createMock(ContainerInterface::class)])
->onlyMethods(['getModelInstance'])
->getMock();

Expand Down

0 comments on commit 1c480b4

Please sign in to comment.