/** * @param NodeInterface|null $node * @param array $arguments * @return \Neos\Flow\Persistence\QueryResultInterface */ public function getData(NodeInterface $node = null, array $arguments) { $formDefinitions['']['label'] = ''; $forms = $this->yamlPersistenceManager->listForms(); foreach ($forms as $form) { $formDefinitions[$form['identifier']]['label'] = $form['name']; } return $formDefinitions; }
/** * @test */ public function listFormsReturnsAvailableForms() { $mockYamlFormDefinition1 = 'type: \'Neos.Form:Form\' identifier: formFixture1 label: \'Form Fixture1\' '; $mockYamlFormDefinition2 = 'type: \'Neos.Form:Form\' identifier: formFixture2 label: \'Form Fixture2\' '; file_put_contents(vfsStream::url('someSavePath/mockForm1.yaml'), $mockYamlFormDefinition1); file_put_contents(vfsStream::url('someSavePath/mockForm2.yaml'), $mockYamlFormDefinition2); file_put_contents(vfsStream::url('someSavePath/noForm.txt'), 'this should be skipped'); $expectedResult = array(array('identifier' => 'formFixture1', 'name' => 'Form Fixture1', 'persistenceIdentifier' => 'mockForm1'), array('identifier' => 'formFixture2', 'name' => 'Form Fixture2', 'persistenceIdentifier' => 'mockForm2')); $this->assertEquals($expectedResult, $this->yamlPersistenceManager->listForms()); }