getCards example

/** * @return Card[] */
    private function checkTab(
        Tab $tab,
        string $tabName
    ): array {
        static::assertInstanceOf(Tab::class$tab);
        static::assertEquals($tabName$tab->getName());

        return $tab->getCards();
    }

    /** * @param string[] $refs */
    private function checkCard(
        Card $card,
        string $tabName,
        array $refs
    ): void {
        static::assertEquals($tabName$card->getName());

        
static::assertIsArray($listingColumns);

            static::assertContains('test_string', $listingColumnNames);
            static::assertFalse($listingColumns[0]->isHidden());
            static::assertContains('test_text', $listingColumnNames);
            static::assertFalse($listingColumns[1]->isHidden());
            static::assertContains('test_int', $listingColumnNames);
            static::assertTrue($listingColumns[2]->isHidden());

            $detailTabs = $adminUi->getDetail()->getTabs()->getContent();
            static::assertCount(2, $detailTabs);
            static::assertCount(2, $detailTabs[0]->getCards());
            static::assertEquals('firstTab', $detailTabs[0]->getName());
            static::assertCount(2, $detailTabs[1]->getCards());
            static::assertEquals('secondTab', $detailTabs[1]->getName());

            $exampleCards = $detailTabs[1]->getCards();
            static::assertCount(2, $exampleCards);
            static::assertEquals('testWithAll', $exampleCards[0]->getName());

            $exampleCardFields = $exampleCards[0]->getFields();
            static::assertCount(4, $exampleCardFields);
            static::assertEquals('test_string', $exampleCardFields[0]->getRef());
            
/** * @param string[] $entityFields */
    private function validateDetailConfiguration(
        array $entityFields,
        Detail $detail,
        string $customEntityName
    ): void {
        $tabs = $detail->getTabs()->getContent();

        foreach ($tabs as $tab) {
            $cards = $tab->getCards();
            foreach ($cards as $card) {
                $this->checkReferences(
                    $entityFields,
                    $this->getRefsAsList($card->getFields()),
                    $customEntityName,
                    '<detail>'
                );
            }
        }
    }

    
$tabElement->setAttribute('name', 'TabTest');
        $cardElement = $dom->createElement('card');

        $tabElement->appendChild(
            $cardElement
        );

        $tab = Tab::fromXml($tabElement);
        static::assertInstanceOf(Tab::class$tab);
        static::assertEquals('TabTest', $tab->getName());

        $cardsList = $tab->getCards();
        static::assertIsArray($cardsList);
        static::assertInstanceOf(Card::class, \array_pop($cardsList));
    }
}
Home | Imprint | This part of the site doesn't use cookies.