<commit_before><?php

namespace Zortje\MVC\Tests\Model;

use Zortje\MVC\Model\EntityProperty;

/**
 * Class EntityPropertyTest
 *
 * @package Zortje\MVC\Tests\Model
 */
class EntityPropertyTest extends \PHPUnit_Framework_TestCase {

	public function testFormatValueStringToString() {
		$property = new EntityProperty('string');

		$this->assertSame('foo', $property->formatValueForEntity('foo'));
	}

	public function testFormatValueStringToInteger() {
		$property = new EntityProperty('integer');

		$this->assertSame(42, $property->formatValueForEntity('42'));
	}

	public function testFormatValueStringToFloat() {
		$property = new EntityProperty('float');

		$this->assertSame(3.14159265359, $property->formatValueForEntity('3.14159265359'));
	}

	public function testFormatValueStringToDateTime() {
		$property = new EntityProperty('DateTime');

		$this->assertEquals(new \DateTime('2015-05-03 01:15:42'), $property->formatValueForEntity('2015-05-03 01:15:42'));
	}

	public function testFormatValueStringToDate() {
		$property = new EntityProperty('Date');

		$this->assertEquals(new \DateTime('2015-05-04'), $property->formatValueForEntity('2015-05-04'));
	}

}<commit_msg>Adding tests<commit_after><?php

namespace Zortje\MVC\Tests\Model;

use Zortje\MVC\Model\EntityProperty;

/**
 * Class EntityPropertyTest
 *
 * @package            Zortje\MVC\Tests\Model
 *
 * @coversDefaultClass Zortje\MVC\Model\EntityProperty
 */
class EntityPropertyTest extends \PHPUnit_Framework_TestCase {

	/**
	 * @covers ::formatValueForEntity
	 */
	public function testFormatValueStringToString() {
		$property = new EntityProperty('string');

		$this->assertSame('foo', $property->formatValueForEntity('foo'));
	}

	/**
	 * @covers ::formatValueForEntity
	 */
	public function testFormatValueStringToInteger() {
		$property = new EntityProperty('integer');

		$this->assertSame(42, $property->formatValueForEntity('42'));
	}

	/**
	 * @covers ::formatValueForEntity
	 */
	public function testFormatValueStringToFloat() {
		$property = new EntityProperty('float');

		$this->assertSame(3.14159265359, $property->formatValueForEntity('3.14159265359'));
	}

	/**
	 * @covers ::formatValueForEntity
	 */
	public function testFormatValueStringToDateTime() {
		$property = new EntityProperty('DateTime');

		$this->assertEquals(new \DateTime('2015-05-03 01:15:42'), $property->formatValueForEntity('2015-05-03 01:15:42'));
	}

	/**
	 * @covers ::formatValueForEntity
	 */
	public function testFormatValueStringToDate() {
		$property = new EntityProperty('Date');

		$this->assertEquals(new \DateTime('2015-05-04'), $property->formatValueForEntity('2015-05-04'));
	}

	/**
	 * @covers ::formatValueForDatabase
	 */
	public function testFormatValueForDatabaseDateTime() {
		$property = new EntityProperty('DateTime');

		$this->assertEquals('2015-05-08 22:42:42', $property->formatValueForDatabase(new \DateTime('2015-05-08 22:42:42')));
	}

	/**
	 * @covers ::formatValueForDatabase
	 */
	public function testFormatValueForDatabaseDate() {
		$property = new EntityProperty('Date');

		$this->assertEquals('2015-05-08', $property->formatValueForDatabase(new \DateTime('2015-05-08')));
	}

	/**
	 * @covers ::__construct
	 */
	public function testConstruct() {
		$property = new EntityProperty('foo');

		$reflector = new \ReflectionClass($property);

		$tableName = $reflector->getProperty('type');
		$tableName->setAccessible(true);
		$this->assertSame('foo', $tableName->getValue($property));
	}

}
{'fraction_non_alphanumeric': 0.15991960953201265, 'fraction_numerical': 0.05397645707723227, 'mean_word_length': 5.536585365853658, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '2536943', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1053, 'n_words': 167}