<commit_before><?php
/**
 * This file is part of the Kappa\Doctrine package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the license.md
 * file that was distributed with this source code.
 *
 * @testCase
 */

namespace KappaTests\Doctrine;

use Kappa\Doctrine\Converters\ArrayToEntityConverter;
use KappaTests\Entities\UserEntity;
use KappaTests\ORMTestCase;
use Tester\Assert;

require_once __DIR__ . '/../../bootstrap.php';

/**
 * Class ArrayToEntityConverterTest
 *
 * @package doctrine\Tests
 * @author <NAME> <http://zaruba-ondrej.cz>
 */
class ArrayToEntityConverterTest extends ORMTestCase
{
	protected function setUp()
	{
		parent::setUp();
	}

	public function testDefaultConvert()
	{
		$data = [
			'name' => 'Tester',
			'parent' => new UserEntity("Tester parent"),
			'children' => [new UserEntity("children")]
		];<commit_msg>ArrayToEntity test: Added entity type tests<commit_after><?php
/**
 * This file is part of the Kappa\Doctrine package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the license.md
 * file that was distributed with this source code.
 *
 * @testCase
 */

namespace KappaTests\Doctrine;

use Kappa\Doctrine\Converters\ArrayToEntityConverter;
use KappaTests\Entities\UserEntity;
use KappaTests\ORMTestCase;
use Tester\Assert;

require_once __DIR__ . '/../../bootstrap.php';

/**
 * Class ArrayToEntityConverterTest
 *
 * @package doctrine\Tests
 * @author <NAME> <http://zaruba-ondrej.cz>
 */
class ArrayToEntityConverterTest extends ORMTestCase
{
	protected function setUp()
	{
		parent::setUp();
	}

	public function testEntityClassname()
	{
		$data = ['name' => 'Tester'];
		$converter = new ArrayToEntityConverter('KappaTests\Entities\UserEntity', $data, $this->em);
		Assert::type('KappaTests\Entities\UserEntity', $converter->convert());
	}

	public function testEntityObject()
	{
		$data = ['name' => 'Tester'];
		$user = new UserEntity("Joe");
		$converter = new ArrayToEntityConverter($user, $data, $this->em);
		$entity = $converter->convert();
		Assert::type('KappaTests\Entities\UserEntity', $entity);
		Assert::same('Tester', $entity->getName());
		Assert::same('Tester', $user->getName());
	}

	public function testDefaultConvert()
	{
		$data = [
			'name' => 'Tester',
			'parent' => new UserEntity("Tester parent"),
			'children' => [new UserEntity("children")]
		];
{'fraction_non_alphanumeric': 0.15285832642916322, 'fraction_numerical': 0.0, 'mean_word_length': 4.629370629370629, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 27, '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': '6000886', 'n_tokens_mistral': 798, 'n_tokens_neox': 768, 'n_words': 186}