|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the API Platform project. |
| 5 | + * |
| 6 | + * (c) Kévin Dunglas <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace ApiPlatform\SchemaGenerator\Tests; |
| 13 | + |
| 14 | +use ApiPlatform\SchemaGenerator\Command\DumpConfigurationCommand; |
| 15 | +use Symfony\Component\Console\Tester\CommandTester; |
| 16 | + |
| 17 | +/** |
| 18 | + * @author Kévin Dunglas <[email protected]> |
| 19 | + */ |
| 20 | +class DumpConfigurationTest extends \PHPUnit_Framework_TestCase |
| 21 | +{ |
| 22 | + public function testDumpConfiguration() |
| 23 | + { |
| 24 | + $commandTester = new CommandTester(new DumpConfigurationCommand()); |
| 25 | + $this->assertEquals(0, $commandTester->execute([])); |
| 26 | + $this->assertEquals(<<<YAML |
| 27 | +config: |
| 28 | +
|
| 29 | + # RDFa files |
| 30 | + rdfa: |
| 31 | +
|
| 32 | + # RDFa URI to use |
| 33 | + uri: 'http://schema.org/docs/schema_org_rdfa.html' # Example: http://schema.org/docs/schema_org_rdfa.html |
| 34 | +
|
| 35 | + # RDFa URI data format |
| 36 | + format: null # Example: rdfxml |
| 37 | +
|
| 38 | + # OWL relation files to use |
| 39 | + relations: |
| 40 | +
|
| 41 | + # Default: |
| 42 | + - http://purl.org/goodrelations/v1.owl |
| 43 | +
|
| 44 | + # Debug mode |
| 45 | + debug: false |
| 46 | +
|
| 47 | + # Automatically add an id field to entities |
| 48 | + generateId: true |
| 49 | +
|
| 50 | + # Generate interfaces and use Doctrine's Resolve Target Entity feature |
| 51 | + useInterface: false |
| 52 | +
|
| 53 | + # Emit a warning if a property is not derived from GoodRelations |
| 54 | + checkIsGoodRelations: false |
| 55 | +
|
| 56 | + # A license or any text to use as header of generated files |
| 57 | + header: false # Example: // (c) Kévin Dunglas <[email protected]> |
| 58 | +
|
| 59 | + # PHP namespaces |
| 60 | + namespaces: |
| 61 | +
|
| 62 | + # The namespace of the generated entities |
| 63 | + entity: SchemaOrg\Entity # Example: Acme\Entity |
| 64 | +
|
| 65 | + # The namespace of the generated enumerations |
| 66 | + enum: SchemaOrg\Enum # Example: Acme\Enum |
| 67 | +
|
| 68 | + # The namespace of the generated interfaces |
| 69 | + interface: SchemaOrg\Model # Example: Acme\Model |
| 70 | +
|
| 71 | + # Doctrine |
| 72 | + doctrine: |
| 73 | +
|
| 74 | + # Use Doctrine's ArrayCollection instead of standard arrays |
| 75 | + useCollection: true |
| 76 | +
|
| 77 | + # The Resolve Target Entity Listener config file pass |
| 78 | + resolveTargetEntityConfigPath: null |
| 79 | +
|
| 80 | + # The value of the phpDoc's @author annotation |
| 81 | + author: false # Example: Kévin Dunglas <[email protected]> |
| 82 | +
|
| 83 | + # Visibility of entities fields |
| 84 | + fieldVisibility: private # One of "private"; "protected"; "public" |
| 85 | +
|
| 86 | + # Schema.org's types to use |
| 87 | + types: |
| 88 | +
|
| 89 | + # Prototype |
| 90 | + id: |
| 91 | +
|
| 92 | + # Namespace of the vocabulary the type belongs to. |
| 93 | + vocabularyNamespace: 'http://schema.org/' |
| 94 | +
|
| 95 | + # Is the class abstract? (null to guess) |
| 96 | + abstract: null |
| 97 | +
|
| 98 | + # Is the class embeddable? |
| 99 | + embeddable: false |
| 100 | +
|
| 101 | + # Type namespaces |
| 102 | + namespaces: |
| 103 | +
|
| 104 | + # The namespace for the generated class (override any other defined namespace) |
| 105 | + class: null |
| 106 | +
|
| 107 | + # The namespace for the generated interface (override any other defined namespace) |
| 108 | + interface: null |
| 109 | + doctrine: |
| 110 | +
|
| 111 | + # The Doctrine inheritance mapping type (override the guessed one) |
| 112 | + inheritanceMapping: null |
| 113 | +
|
| 114 | + # The parent class, set to false for a top level class |
| 115 | + parent: null |
| 116 | +
|
| 117 | + # If declaring a custom class, this will be the class from which properties type will be guessed |
| 118 | + guessFrom: Thing |
| 119 | +
|
| 120 | + # Import all existing properties |
| 121 | + allProperties: false |
| 122 | +
|
| 123 | + # Properties of this type to use |
| 124 | + properties: |
| 125 | +
|
| 126 | + # Prototype |
| 127 | + id: |
| 128 | +
|
| 129 | + # The property range |
| 130 | + range: null # Example: Offer |
| 131 | +
|
| 132 | + # The relation table name |
| 133 | + relationTableName: null # Example: organization_member |
| 134 | + cardinality: unknown # One of "(0..1)"; "(0..*)"; "(1..1)"; "(1..*)"; "(*..0)"; "(*..1)"; "(*..*)"; "unknown" |
| 135 | +
|
| 136 | + # The doctrine column annotation content |
| 137 | + ormColumn: null # Example: type="decimal", precision=5, scale=1, options={"comment" = "my comment"} |
| 138 | +
|
| 139 | + # Symfony Serialization Groups |
| 140 | + groups: [] |
| 141 | +
|
| 142 | + # The property nullable |
| 143 | + nullable: true |
| 144 | +
|
| 145 | + # The property unique |
| 146 | + unique: false |
| 147 | +
|
| 148 | + # Is the property embedded? |
| 149 | + embedded: false |
| 150 | +
|
| 151 | + # The property columnPrefix |
| 152 | + columnPrefix: false |
| 153 | +
|
| 154 | + # Annotation generators to use |
| 155 | + annotationGenerators: |
| 156 | +
|
| 157 | + # Defaults: |
| 158 | + - ApiPlatform\SchemaGenerator\AnnotationGenerator\PhpDocAnnotationGenerator |
| 159 | + - ApiPlatform\SchemaGenerator\AnnotationGenerator\ConstraintAnnotationGenerator |
| 160 | + - ApiPlatform\SchemaGenerator\AnnotationGenerator\DoctrineOrmAnnotationGenerator |
| 161 | +
|
| 162 | +
|
| 163 | +YAML |
| 164 | +, $commandTester->getDisplay()); |
| 165 | + } |
| 166 | +} |
0 commit comments