public function testMethodString4getStringFromStrategyOutput() { $property = new Property(); $property->setPropertyName("testName"); $property->setTargetEntity("Application\\Entity\\TestTargetEntity"); $property->setAssociation(4); $methodString4 = new MethodString4($property); $resultingMethodString = $methodString4->getStringFromStrategy(); $expectedOutput = "\tpublic function addToTestName(\\Application\\Entity\\TestTargetEntity \$singleEntity) {\n\t\t\$this->testName->add(\$singleEntity);\n\t\treturn \$this;\n\t}\n\n\tpublic function addTestName(Collection \$testName) {\n\t\tforeach(\$testName as \$singleEntity) {\n\t\t\t\$this->testName->add(\$singleEntity);\n\t\t}\n\t\treturn \$this;\n\t}\n\n\tpublic function removeFromTestName(\\Application\\Entity\\TestTargetEntity \$singleEntity) {\n\t\t\$this->testName->removeElement(\$singleEntity);\n\t\treturn \$this;\n\t}\n\n\tpublic function removeTestName(Collection \$testName) {\n\t\tforeach(\$testName as \$singleEntity) {\n\t\t\t\$this->testName->removeElement(\$singleEntity);\n\t\t}\n\t\treturn \$this;\n\t}\n\n\tpublic function clearTestName() {\n\t\t\$this->testName->clear();\n\t\treturn \$this;\n\t}\n\n\tpublic function getTestName() {\n\t\treturn \$this->testName;\n\t}\n\n\tpublic function setTestName(\$testName) {\n\t\t\$this->clearTestName();\n\t\tforeach(\$testName as \$singleEntity) {\n\t\t\t\$this->addToTestName(\$singleEntity);\n\t\t}\n\t\treturn \$this;\n\t}\n\n"; $this->assertEquals($expectedOutput, $resultingMethodString); }
public function testMethodString3getStringFromStrategyOutput() { $property = new Property(); $property->setPropertyName("testName"); $property->setTargetEntity("Application\\Entity\\TestTargetEntity"); $property->setAssociation(3); $methodString3 = new MethodString3($property); $resultingMethodString = $methodString3->getStringFromStrategy(); $expectedOutput = "\tpublic function setTestName(\\Application\\Entity\\TestTargetEntity \$testName = null) {\n\t\tif(\$testName == null) {\n\t\t\t\$this->testName->set(null);\n\t\t\t\$this->testName = \$testName;\n\t\t}else {\n\t\t\t\$this->testName = \$testName;\n\t\t\t\$this->testName->set(\$this);\n\t\t}\n\t\treturn \$this;\n\t}\n\n\tpublic function getTestName() {\n\t\treturn \$this->testName;\n\t}\n\n"; $this->assertEquals($expectedOutput, $resultingMethodString); }
public function testMethodString6getStringFromStrategyOutput() { $property = new Property(); $property->setPropertyName("testName"); $property->setTargetEntity("Application\\Entity\\TestTargetEntity"); $property->setInverse("testInversedBy"); $property->setAssociation(6); $methodString6 = new MethodString6($property); $resultingMethodString = $methodString6->getStringFromStrategy(); $expectedOutput = "\tpublic function setTestName(\\Application\\Entity\\TestTargetEntity \$testName = null) {\n\t\t\$this->testName = \$testName;\n\t\t(\$this->testName) ? \$this->testName->addToTestInversedBy(\$this) : \$this->testName->removeFromTestInversedBy(\$this);\n\t\treturn \$this;\n\t}\n\n\tpublic function getTestName() {\n\t\treturn \$this->testName;\n\t}\n\n"; $this->assertEquals($expectedOutput, $resultingMethodString); }