<commit_before><?php

use Pippin\IPN;

class IPNTest extends PHPUnit_Framework_TestCase {

	function testIPNReturnsData() {
		$sampleData = [
			'txn_id' => 'e8d7334423af0713ce8367c0a6aebba8',
			'payer_email' => '<EMAIL>',
			'receiver_email' => '<EMAIL>',
			'mc_currency' => '17000'
		];

		$ipn = new IPN($sampleData);
		$this->assertEquals($ipn->getTransactionId(), $sampleData['txn_id']);
		$this->assertEquals($ipn->getPayerEmail(), $sampleData['payer_email']);
		$this->assertEquals($ipn->getReceiverEmail(), $sampleData['receiver_email']);
		$this->assertEquals($ipn->getData(), $sampleData);
	}

	function testIPNReturnsNull() {
		$sampleData = [
			'mc_currency' => '17000'
		];

		$ipn = new IPN($sampleData);
		$this->assertEquals($ipn->getTransactionId(), null);
		$this->assertEquals($ipn->getPayerEmail(), null);
		$this->assertEquals($ipn->getReceiverEmail(), null);
		$this->assertEquals($ipn->getData(), $sampleData);
	}

	/**
	 * @expectedException RuntimeException
	 */
	function testIPNDisallowsSettingOffset() {
		$ipn = new IPN([]);
		$ipn['custom'] = 'Hello, world';
	}

	/**
	 * @expectedException RuntimeException
	 */
	function testIPNDisallowsUnsettingOffset() {
		$ipn = new IPN(['custom' => 'Hello, world']);
		unset($ipn['custom']);
	}

	function testIPNReturnsIssetForOffset() {
		$ipn = new IPN(['custom' => 'Hello, world']);

		$this->assertTrue(isset($ipn['custom']));
		$this->assertFalse(isset($ipn['mc_currency']));
	}

	function testIPNGetsOffset() {
		$ipn = new IPN(['custom' => 'Hello, world']);

		$this->assertEquals($ipn['custom'], 'Hello, world');
		$this->assertEquals($ipn['custom'], $ipn->getCustom());
	}

}
<commit_msg>Update tests for new API.<commit_after><?php

use Pippin\IPN;

class IPNTest extends PHPUnit_Framework_TestCase {

	function testIPNReturnsData() {
		$sampleData = [
			'txn_id' => 'e8d7334423af0713ce8367c0a6aebba8',
			'payer_email' => '<EMAIL>',
			'receiver_email' => '<EMAIL>',
			'mc_currency' => '17000'
		];

		$ipn = new IPN($sampleData);
		$this->assertEquals($ipn->getTransactionIds(), [$sampleData['txn_id']]);
		$this->assertEquals($ipn->getPayerEmail(), $sampleData['payer_email']);
		$this->assertEquals($ipn->getReceiverEmails(), [$sampleData['receiver_email']]);
		$this->assertEquals($ipn->getData(), $sampleData);
	}

	function testIPNReturnsNull() {
		$sampleData = [
			'mc_currency' => '17000'
		];

		$ipn = new IPN($sampleData);
		$this->assertEquals($ipn->getTransactionIds(), []);
		$this->assertEquals($ipn->getPayerEmail(), null);
		$this->assertEquals($ipn->getReceiverEmails(), []);
		$this->assertEquals($ipn->getData(), $sampleData);
	}

	/**
	 * @expectedException RuntimeException
	 */
	function testIPNDisallowsSettingOffset() {
		$ipn = new IPN([]);
		$ipn['custom'] = 'Hello, world';
	}

	/**
	 * @expectedException RuntimeException
	 */
	function testIPNDisallowsUnsettingOffset() {
		$ipn = new IPN(['custom' => 'Hello, world']);
		unset($ipn['custom']);
	}

	function testIPNReturnsIssetForOffset() {
		$ipn = new IPN(['custom' => 'Hello, world']);

		$this->assertTrue(isset($ipn['custom']));
		$this->assertFalse(isset($ipn['mc_currency']));
	}

	function testIPNGetsOffset() {
		$ipn = new IPN(['custom' => 'Hello, world']);

		$this->assertEquals($ipn['custom'], 'Hello, world');
		$this->assertEquals($ipn['custom'], $ipn->getCustom());
	}

}

{'fraction_non_alphanumeric': 0.20756402620607506, 'fraction_numerical': 0.017272185824895772, 'mean_word_length': 5.612204724409449, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 65, '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': '2050078', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1186, 'n_words': 174}