/**
  * @depends testCreate
  */
 public function testUpdate()
 {
     $result = ToolsAPI::getEntityGrid($this->client, 'email-notification-grid', array('email-notification-grid[_pager][_page]' => 1, 'email-notification-grid[_pager][_per_page]' => 1));
     ToolsAPI::assertJsonResponse($result, 200);
     $result = ToolsAPI::jsonToArray($result->getContent());
     $result = reset($result['data']);
     $crawler = $this->client->request('GET', $this->client->generate('oro_notification_emailnotification_update', array('id' => $result['id'])));
     // prepare data for next tests
     $this->prepareData();
     /** @var Form $form */
     $form = $crawler->selectButton('Save and Close')->form();
     $form['emailnotification[entityName]'] = 'Oro\\Bundle\\UserBundle\\Entity\\User';
     $form['emailnotification[event]'] = $this->eventCreate->getId();
     $doc = new \DOMDocument("1.0");
     $doc->loadHTML('<select required="required" name="emailnotification[template]" id="emailnotification_template" ' . 'tabindex="-1" class="select2-offscreen"> ' . '<option value="" selected="selected"></option> ' . '<option value="' . $this->templateUpdate->getId() . '">' . 'EmailBundle:' . $this->templateUpdate->getName() . '</option> </select>');
     $field = new ChoiceFormField($doc->getElementsByTagName('select')->item(0));
     $form->set($field);
     $form['emailnotification[template]'] = $this->templateUpdate->getId();
     $form['emailnotification[recipientList][users]'] = '1';
     $form['emailnotification[recipientList][groups][0]'] = '1';
     $form['emailnotification[recipientList][email]'] = '*****@*****.**';
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 200, 'text/html; charset=UTF-8');
     $this->assertContains("Email notification rule saved", $crawler->html());
 }
 public function testSubmit()
 {
     $form = $this->chooseEmbeddedFormFromGrid();
     $formViewUrl = $this->getUrl('diamante_embedded_form_submit', array('id' => $form['id']));
     $crawler = $this->client->request('GET', $formViewUrl);
     /** @var Form $form */
     $form = $crawler->selectButton('Submit')->form();
     $form['diamante_embedded_form[firstName]'] = 'John';
     $form['diamante_embedded_form[lastName]'] = 'Smith';
     $form['diamante_embedded_form[emailAddress]'] = '*****@*****.**';
     $form['diamante_embedded_form[subject]'] = 'Subject of ticket';
     $form['diamante_embedded_form[description]'] = 'Write something about problem';
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $response = $this->client->getResponse();
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertContains("Ticket has been placed successfully", $crawler->html());
 }
 public function testUpdate()
 {
     $result = ToolsAPI::getEntityGrid($this->client, 'tag-grid', array('tag-grid[_filter][name][value]' => 'tag758'));
     ToolsAPI::assertJsonResponse($result, 200);
     $result = ToolsAPI::jsonToArray($result->getContent());
     $result = reset($result['data']);
     $crawler = $this->client->request('GET', $this->client->generate('oro_tag_update', array('id' => $result['id'])));
     $form = $crawler->selectButton('Save')->form();
     $form['oro_tag_tag_form[name]'] = 'tag758_updated';
     $form['oro_tag_tag_form[owner]'] = 1;
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 200, 'text/html; charset=UTF-8');
     $this->assertContains("Tag saved", $crawler->html());
     $result = ToolsAPI::getEntityGrid($this->client, 'tag-grid', array('tag-grid[_filter][name][value]' => 'tag758_updated'));
     ToolsAPI::assertJsonResponse($result, 200);
     $result = ToolsAPI::jsonToArray($result->getContent());
     $result = reset($result['data']);
     $this->assertEquals('tag758_updated', $result['name']);
 }
 public function prepareFixture()
 {
     $crawler = $this->client->request('GET', $this->client->generate('oro_user_create'));
     $form = $crawler->selectButton('Save and Close')->form();
     $form['oro_user_user_form[enabled]'] = $this->userData['enabled'];
     $form['oro_user_user_form[username]'] = $this->userData['username'];
     $form['oro_user_user_form[plainPassword][first]'] = 'password';
     $form['oro_user_user_form[plainPassword][second]'] = 'password';
     $form['oro_user_user_form[firstName]'] = $this->userData['firstName'];
     $form['oro_user_user_form[lastName]'] = $this->userData['lastName'];
     $form['oro_user_user_form[birthday]'] = $this->userData['birthday'];
     $form['oro_user_user_form[email]'] = $this->userData['email'];
     $form['oro_user_user_form[groups][1]'] = 2;
     $form['oro_user_user_form[rolesCollection][1]'] = true;
     $form['oro_user_user_form[owner]'] = 1;
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 200, 'text/html; charset=UTF-8');
     $this->assertContains("User saved", $crawler->html());
 }
 public function testCreate()
 {
     $this->markTestIncomplete('Skipped due to issue with dynamic form loading');
     $crawler = $this->client->request('GET', $this->client->generate('oro_email_emailtemplate_create'));
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->loadHTML($crawler->html());
     $dom->getElementById('oro_email_emailtemplate');
     $form = $crawler->filterXPath("//form[@name='oro_email_emailtemplate']");
     $form = $crawler->selectButton('Save and Close')->form();
     $fields = $form->all();
     $form['oro_email_emailtemplate[entityName]'] = 'Oro\\Bundle\\UserBundle\\Entity\\User';
     $form['oro_email_emailtemplate[name]'] = 'User Template';
     $form['oro_email_emailtemplate[translations][defaultLocale][en][content]'] = 'Content template';
     $form['oro_email_emailtemplate[translations][defaultLocale][en][subject]'] = 'Subject';
     $form['oro_email_emailtemplate[type]'] = 'html';
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 200, '');
     $this->assertContains("Template saved", $crawler->html());
 }
 /**
  * @depends testCreate
  * @return string
  */
 public function testUpdate()
 {
     $result = ToolsAPI::getEntityGrid($this->client, 'business-unit-grid', array('business-unit-grid[_filter][name][value]' => 'testBU'));
     ToolsAPI::assertJsonResponse($result, 200);
     $result = ToolsAPI::jsonToArray($result->getContent());
     $result = reset($result['data']);
     $crawler = $this->client->request('GET', $this->client->generate('oro_business_unit_update', array('id' => $result['id'])));
     /** @var Form $form */
     $form = $crawler->selectButton('Save and Close')->form();
     $form['oro_business_unit_form[name]'] = 'testBU_Updated';
     $form['oro_business_unit_form[owner]'] = 1;
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 200, 'text/html; charset=UTF-8');
     $this->assertContains("Business Unit saved", $crawler->html());
     $result = ToolsAPI::getEntityGrid($this->client, 'business-unit-grid', array('business-unit-grid[_filter][name][value]' => 'testBU_Updated'));
     ToolsAPI::assertJsonResponse($result, 200);
     $result = ToolsAPI::jsonToArray($result->getContent());
     $result = reset($result['data']);
     return $result['id'];
 }
 public function testUpdateProfile()
 {
     $crawler = $this->client->request('GET', $this->client->generate('oro_user_profile_update'));
     ToolsAPI::assertJsonResponse($this->client->getResponse(), 200, 'text/html; charset=UTF-8');
     $this->assertContains('John Doe - Edit - Users - Users Management - System', $this->client->getResponse()->getContent());
     /** @var Form $form */
     $form = $crawler->selectButton('Save and Close')->form();
     $form['oro_user_user_form[birthday]'] = '1999-01-01';
     $this->client->followRedirects(true);
     $crawler = $this->client->submit($form);
     $result = $this->client->getResponse();
     ToolsAPI::assertJsonResponse($result, 200, 'text/html; charset=UTF-8');
     $this->assertContains("User saved", $crawler->html());
     $crawler = $this->client->request('GET', $this->client->generate('oro_user_profile_update'));
     ToolsAPI::assertJsonResponse($this->client->getResponse(), 200, 'text/html; charset=UTF-8');
     $this->assertContains('John Doe - Edit - Users - Users Management - System', $this->client->getResponse()->getContent());
     /** @var Form $form */
     $form = $crawler->selectButton('Save and Close')->form();
     $this->assertEquals('1999-01-01', $form['oro_user_user_form[birthday]']->getValue());
 }