public function testBuildStringWithAllTheParametersProvided()
 {
     $propertyExtractor = new PropertyExtractor();
     $postData = ['entityProperties' => [0 => ['propertyName' => 'test', 'association' => 6, 'targetEntity' => 'Application\\Entity\\TestTargetEntity', 'inverse' => "testInversedBy"]]];
     $propertiesArray = $propertyExtractor->convertPostToPropertyObjects($postData);
     $ormStringCreator = new ORMStringCreator();
     $ormStringFinalOutput = $ormStringCreator->getORMStringsForProperties($propertiesArray);
     $this->assertEquals("\t/** \n\t* @ORM\\ManyToOne(targetEntity=\"Application\\Entity\\TestTargetEntity\", inversedBy=\"testInversedBy\")\n\t*/\n\tprotected \$test;\n\n", $ormStringFinalOutput);
 }
 public function testBuildStringWithAllRequiredParameters()
 {
     $propertyExtractor = new PropertyExtractor();
     $postData = ['entityProperties' => [0 => ['propertyName' => 'test', 'association' => 13, 'targetEntity' => 'Application\\Entity\\TestTargetEntity', 'inverse' => 'testInversedBy', 'joinColumn1' => "testJoinColumn1", 'refColumn1' => 'testRefColumn1']]];
     $propertiesArray = $propertyExtractor->convertPostToPropertyObjects($postData);
     $ormStringCreator = new ORMStringCreator();
     $ormStringFinalOutput = $ormStringCreator->getORMStringsForProperties($propertiesArray);
     $this->assertEquals("\t/** \n\t* @ORM\\ManyToOne(targetEntity=\"Application\\Entity\\TestTargetEntity\", inversedBy=\"testInversedBy\")\n\t* @ORM\\JoinColumn(name=\"testJoinColumn1\", referencedColumnName=\"testRefColumn1\")\n\t*/\n\tprotected \$test;\n\n", $ormStringFinalOutput);
 }
 public function testBuildStringWithCascadePersistMergeRemove()
 {
     $propertyExtractor = new PropertyExtractor();
     $postData = ['entityProperties' => [0 => ['propertyName' => 'test', 'association' => 3, 'targetEntity' => 'Application\\Entity\\TestTargetEntity', 'inverse' => "testInversedBy", 'cascade' => '{"persist", "merge", "remove"}', 'joinColumn1' => "testJoinColumn1", 'refColumn1' => 'testRefColumn1']]];
     $propertiesArray = $propertyExtractor->convertPostToPropertyObjects($postData);
     $ormStringCreator = new ORMStringCreator();
     $ormStringFinalOutput = $ormStringCreator->getORMStringsForProperties($propertiesArray);
     $this->assertEquals("\t/** \n\t* @ORM\\OneToOne(targetEntity=\"Application\\Entity\\TestTargetEntity\", inversedBy=\"testInversedBy\", cascade={\"persist\", \"merge\", \"remove\"})\n\t* @ORM\\JoinColumn(name=\"testJoinColumn1\", referencedColumnName=\"testRefColumn1\", nullable=true, onDelete=\"SET NULL\")\n\t*/\n\tprotected \$test;\n\n", $ormStringFinalOutput);
 }
 public function testBuildStringWithCascadePersistMergeRemove()
 {
     $propertyExtractor = new PropertyExtractor();
     $postData = ['entityProperties' => [0 => ['propertyName' => 'test', 'association' => 8, 'targetEntity' => 'Application\\Entity\\TestTargetEntity', 'cascade' => '{"persist", "merge", "remove"}']]];
     $propertiesArray = $propertyExtractor->convertPostToPropertyObjects($postData);
     $ormStringCreator = new ORMStringCreator();
     $ormStringFinalOutput = $ormStringCreator->getORMStringsForProperties($propertiesArray);
     $this->assertEquals("\t/** \n\t* @ORM\\ManyToMany(targetEntity=\"Application\\Entity\\TestTargetEntity\", cascade={\"persist\", \"merge\", \"remove\"})\n\t*/\n\tprotected \$test;\n\n", $ormStringFinalOutput);
 }
 public function testBuildStringWhenColumnNameOtherThanPropertyName()
 {
     $propertyExtractor = new PropertyExtractor();
     $postData = ['entityProperties' => [0 => ['propertyName' => 'test', 'columnType' => "integer", 'column' => 'test_test', 'association' => 0]]];
     $propertiesArray = $propertyExtractor->convertPostToPropertyObjects($postData);
     $ormStringCreator = new ORMStringCreator();
     $ormStringFinalOutput = $ormStringCreator->getORMStringsForProperties($propertiesArray);
     $this->assertEquals("\t/** \n\t* @ORM\\Column(type=\"integer\", name=\"test_test\")\n\t*/\n\tprotected \$test;\n\n", $ormStringFinalOutput);
 }
 public function testBuildStringWithCascadePersistMergeRemove()
 {
     $propertyExtractor = new PropertyExtractor();
     $postData = ['entityProperties' => [0 => ['propertyName' => 'test', 'association' => 4, 'targetEntity' => 'Application\\Entity\\TestTargetEntity', 'joinTable' => 'testJoinTable', 'joinColumn1' => "testJoinColumn1", 'refColumn1' => 'testRefColumn1', 'joinColumn2' => "testJoinColumn2", 'refColumn2' => 'testRefColumn2', 'cascade' => '{"persist", "merge", "remove"}']]];
     $propertiesArray = $propertyExtractor->convertPostToPropertyObjects($postData);
     $ormStringCreator = new ORMStringCreator();
     $ormStringFinalOutput = $ormStringCreator->getORMStringsForProperties($propertiesArray);
     $this->assertEquals("\t/** \n\t* @ORM\\ManyToMany(targetEntity=\"Application\\Entity\\TestTargetEntity\", cascade={\"persist\", \"merge\", \"remove\"})\n\t* @ORM\\JoinTable(name=\"testJoinTable\",\n\t*\tjoinColumns={@ORM\\JoinColumn(name=\"testJoinColumn1\", referencedColumnName=\"testRefColumn1\")},\n\t*\tinverseJoinColumns={@ORM\\JoinColumn(name=\"testJoinColumn2\", referencedColumnName=\"testRefColumn2\", unique=true, onDelete=\"CASCADE\")}\n\t* )\n\t*/\n\tprotected \$test;\n\n", $ormStringFinalOutput);
 }