Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Sep 15, 2022
1 parent 3348d0a commit 7dd1052
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
2 changes: 2 additions & 0 deletions core-bundle/tests/Contao/DataContainerTest.php
Expand Up @@ -23,8 +23,10 @@ class DataContainerTest extends TestCase
public function testCombiner(array $source, array $expected): void
{
$class = new \ReflectionClass(DC_Table::class);

$method = $class->getMethod('combiner');
$method->setAccessible(true);

$names = $method->invoke($class->newInstanceWithoutConstructor(), $source);

$this->assertSame($expected, array_values($names));
Expand Down
Expand Up @@ -18,7 +18,7 @@
use Contao\Database\Statement;
use Contao\DC_Table;

class DC_TableTest extends TestCase
class DcTableTest extends TestCase
{
/**
* @dataProvider getPalette
Expand All @@ -28,7 +28,6 @@ public function testGetPalette(array $dca, array $row, string $expected): void
$result = new Result([$row], '');

$statement = $this->createMock(Statement::class);

$statement
->method('limit')
->willReturn($statement)
Expand All @@ -46,14 +45,13 @@ public function testGetPalette(array $dca, array $row, string $expected): void
;

$reflection = new \ReflectionClass(DC_Table::class);
$dataContainer = $reflection->newInstanceWithoutConstructor();

$method = $reflection->getMethod('import');
$method->setAccessible(true);
$method->invoke($dataContainer, $database, 'Database');
$dataContainer = $reflection->newInstanceWithoutConstructor();
$dataContainer->Database = $database;

/** @phpstan-ignore-next-line */
$dataContainer->strTable = 'tl_test';
$table = $reflection->getProperty('strTable');
$table->setAccessible(true);
$table->setValue($dataContainer, 'tl_test');

$GLOBALS['TL_DCA']['tl_test'] = $dca;

Expand All @@ -62,28 +60,26 @@ public function testGetPalette(array $dca, array $row, string $expected): void

public function getPalette(): array
{
return [
return [[
[
[
'palettes' => [
'__selector__' => ['fieldA', 'fieldB', 'fieldC'],
'default' => 'paletteDefault',
'valueA' => 'paletteA',
'valueAvalueC' => 'paletteAC',
],
'fields' => [
'fieldA' => ['inputType' => 'text'],
'fieldB' => ['inputType' => 'text'],
'fieldC' => ['inputType' => 'text'],
],
'palettes' => [
'__selector__' => ['fieldA', 'fieldB', 'fieldC'],
'default' => 'paletteDefault',
'valueA' => 'paletteA',
'valueAvalueC' => 'paletteAC',
],
[
'fieldA' => 'valueA',
'fieldB' => null,
'fieldC' => 'valueC',
'fields' => [
'fieldA' => ['inputType' => 'text'],
'fieldB' => ['inputType' => 'text'],
'fieldC' => ['inputType' => 'text'],
],
'paletteAC',
],
];
[
'fieldA' => 'valueA',
'fieldB' => null,
'fieldC' => 'valueC',
],
'paletteAC',
]];
}
}

0 comments on commit 7dd1052

Please sign in to comment.