<commit_before><?php

/**
 * @file
 * Contains \Eloqua\Tests\Api\Data\ContactTest.
 */

namespace Eloqua\Tests\Api\Data;

use Eloqua\Tests\Api\TestCase;

class ContactTest extends TestCase {

  /**
   * @test
   */
  public function shouldSearchContacts() {
    $email_address = '<EMAIL>';
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contacts', array('search' => $email_address))
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->search($email_address));
  }

  /**
   * @test
   */
  public function shouldSearchContactsWithOptions() {
    $email_address = '<EMAIL>';
    $options = array('count' => 5);
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contacts', array_merge(array('search' => $email_address), $options))
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->search($email_address, $options));
  }

  /**
   * @test
   */
  public function shouldShowContact() {
    $contact_id = 1337;
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contact/' . $contact_id)
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->show($contact_id));
  }

  /**
   * @test
   */
  public function shouldUpdateContact() {
    $contact_id = 1337;
    $contact_data = array('emailAddress' => '<EMAIL>');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('put')
      ->with('data/contact/' . $contact_id, $contact_data)
      ->will($this->returnValue($contact_data));

    $this->assertEquals($contact_data, $api->update($contact_id, $contact_data));
  }

  /**
   * @test
   */
  public function shouldGetSubscriptions() {
    $contact_id = 1337;
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contact/' . $contact_id . '/email/groups/subscription')
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->subscriptions($contact_id));
  }

  protected function getApiClass() {
    return 'Eloqua\Api\Data\Contact';
  }

}<commit_msg>Adding tests to ensure contact removal works as expected.<commit_after><?php

/**
 * @file
 * Contains \Eloqua\Tests\Api\Data\ContactTest.
 */

namespace Eloqua\Tests\Api\Data;

use Eloqua\Tests\Api\TestCase;

class ContactTest extends TestCase {

  /**
   * @test
   */
  public function shouldSearchContacts() {
    $email_address = '<EMAIL>';
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contacts', array('search' => $email_address))
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->search($email_address));
  }

  /**
   * @test
   */
  public function shouldSearchContactsWithOptions() {
    $email_address = '<EMAIL>';
    $options = array('count' => 5);
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contacts', array_merge(array('search' => $email_address), $options))
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->search($email_address, $options));
  }

  /**
   * @test
   */
  public function shouldShowContact() {
    $contact_id = 1337;
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contact/' . $contact_id)
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->show($contact_id));
  }

  /**
   * @test
   */
  public function shouldUpdateContact() {
    $contact_id = 1337;
    $contact_data = array('emailAddress' => '<EMAIL>');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('put')
      ->with('data/contact/' . $contact_id, $contact_data)
      ->will($this->returnValue($contact_data));

    $this->assertEquals($contact_data, $api->update($contact_id, $contact_data));
  }

  /**
   * @test
   */
  public function shouldRemoveContact() {
    $contact_id = 1337;
    $expected_response = null;

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('delete')
      ->with('data/contact/' . $contact_id)
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->remove($contact_id));
  }

  /**
   * @test
   */
  public function shouldGetSubscriptions() {
    $contact_id = 1337;
    $expected_response = array('response');

    $api = $this->getApiMock();
    $api->expects($this->once())
      ->method('get')
      ->with('data/contact/' . $contact_id . '/email/groups/subscription')
      ->will($this->returnValue($expected_response));

    $this->assertEquals($expected_response, $api->subscriptions($contact_id));
  }

  protected function getApiClass() {
    return 'Eloqua\Api\Data\Contact';
  }

}
{'fraction_non_alphanumeric': 0.19496389557489355, 'fraction_numerical': 0.005554526939455656, 'mean_word_length': 3.5509688289806234, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 116, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2627588', 'n_tokens_mistral': 1766, 'n_tokens_neox': 1701, 'n_words': 251}