public function testSetName() { // new entity $position = new Position(); // Use the setName method $position->setName("Leder"); // Assert the result $this->assertEquals("Leder", $position->getName()); }
public function load(ObjectManager $manager) { $positions = array(array('name' => 'Software Developer Sr'), array('name' => 'Software Developer Mid'), array('name' => 'Software Developer Jr'), array('name' => 'UX Designer Sr'), array('name' => 'UX Designer Mid'), array('name' => 'UX Designer Jr'), array('name' => 'UI Designer Sr'), array('name' => 'UI Designer Mid'), array('name' => 'UI Designer Jr'), array('name' => 'Contador'), array('name' => 'RH'), array('name' => 'Backend Developer Sr'), array('name' => 'Backend Developer Mid'), array('name' => 'Backend Developer Jr'), array('name' => 'Frontend Developer Sr'), array('name' => 'Frontend Developer Mid'), array('name' => 'Frontend Developer Jr')); foreach ($positions as $role) { $entity = new Position(); $entity->setName($role['name']); $manager->persist($entity); } $manager->flush(); }
public function testSetPosition() { // new entity $wh = new WorkHistory(); // dummy entity $position = new Position(); $position->setName("Superleder"); // Use the setPosition method $wh->setPosition($position); // Assert the result $this->assertEquals($position, $wh->getPosition()); }
public function load(ObjectManager $manager) { $position1 = new Position(); $position1->setName("Leder"); $manager->persist($position1); $position2 = new Position(); $position2->setName("Medlem"); $manager->persist($position2); $manager->flush(); $this->addReference('position-1', $position1); $this->addReference('position-2', $position2); }
/** * @dataProvider getValidTestData */ public function testForm($data) { $type = new CreatePositionType(); $form = $this->factory->create($type); $object = new Position(); $object->fromArray($data); // submit the data to the form directly $form->submit($data); $this->assertTrue($form->isSynchronized()); $this->assertEquals($object, $form->getData()); $view = $form->createView(); $children = $view->children; foreach (array_keys($data) as $key) { $this->assertArrayHasKey($key, $children); } }
/** * Creates a new Position entity. * * @Route("/create", name="position_create_ajax", options={"expose"=true}) * @Method("POST") */ public function createAction(Request $request) { $em = $this->getDoctrine()->getManager(); $position = new Position(); $position->setName($request->get('name')); $em->persist($position); $em->flush(); $result = ""; $response = new Response(); $response->setContent(json_encode(array('result' => $result))); return $response; }