Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Feb 29, 2024
1 parent 7429ee5 commit 121ffe6
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/EventListener/DcaField/DateAddedFieldListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public function testOnLoadDataContainer()
$table = 'test_table';

// Mock the global array
$GLOBALS['TL_DCA'][$table] = [];
$GLOBALS['TL_DCA'][$table] = [
'config' => [],
'fields' => [],
];

$listener->onLoadDataContainer($table);

Expand Down Expand Up @@ -47,8 +50,17 @@ public function testOnLoadCallback()
->getMock();

$dc->id = 1;
$dc->method('__get')->willReturnCallback(function ($name) {
switch ($name) {
case 'table':
return 'test_table';
case 'id':
return 1;
}
});

$model = $this->getMockBuilder(Model::class)
->disableOriginalConstructor()
->onlyMethods(['save'])
->getMock();

Expand All @@ -71,9 +83,17 @@ public function testOnCopyCallback()
->disableOriginalConstructor()
->getMock();

$dc->id = 1;
$dc->method('__get')->willReturnCallback(function ($name) {
switch ($name) {
case 'table':
return 'test_table';
case 'id':
return 1;
}
});

$model = $this->getMockBuilder(Model::class)
->disableOriginalConstructor()
->onlyMethods(['save'])
->getMock();

Expand Down

0 comments on commit 121ffe6

Please sign in to comment.