Skip to content
Snippets Groups Projects
Commit b3a3f421 authored by Mikael Meulle's avatar Mikael Meulle
Browse files

added tests

parent a03e4004
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,32 @@ class LinksPropTypeTest extends PropTypeNormalizationTestBase {
$this->assertEquals($normalized, $expected);
}
/**
* Test normalize static method with manual data.
*/
public function testNormalizationManualData() : void {
$tests = [
"Menu, as generated by the Menu module" => self::menu(),
"Standardized structure, flat, with objects" => self::standardizedFlatObjects(),
];
foreach ($tests as $test) {
$value = $test[0];
$expected = $test[1];
$normalized = LinksPropType::normalize($value, $this->testComponentProps['links']);
$n_items = count($normalized);
$this->assertCount(count($expected), $normalized);
for ($i = 0; $i < $n_items; $i++) {
$item = array_pop($normalized);
$expected_item = array_pop($expected);
foreach ($expected_item as $key => $value) {
$this->assertEquals($value, $item[$key] ?? NULL);
break;
}
}
// $this->assertEquals($normalized, $expected);
}
}
/**
* Test rendered component with prop.
*
......@@ -108,13 +134,10 @@ class LinksPropTypeTest extends PropTypeNormalizationTestBase {
],
],
"Standardized structure, flat, only primitives" => self::standardizedFlatPrimitives(),
// "Standardized structure, flat, with objects" =>
// self::standardizedFlatObjects(),
"Breadcrumb structure, as generated by the core service" => self::breadcrumb(),
"Mini pager, as generated by the Views module" => self::viewsMiniPager(),
"Pager's pages, as generated by the Views module" => self::pagerPages(),
"Pager's navigation links, as generated by the Views module" => self::pagesNavigationLinks(),
// "Menu, as generated by the Menu module" => self::menu(),
"Where link_attributes is already manually set" => self::linkAttributes(),
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment