<?php

namespace ActivityPhpTest\Type;

use ActivityPhp\Type;
use ActivityPhp\Type\TypeConfiguration as Config;
use PHPUnit\Framework\TestCase;

class TypeConfigurationTest extends TestCase
{
	/**
	 * Giving a value for an undefined property - 'ignore' mode
	 * This should return null as property is ignored
	 */
	public function testIgnoreModeDoesNotThrowException()
	{
		$type = Type::create('Note');

		Config::set('undefined_properties', 'ignore');

		$this->assertEquals(
		    null,
		    $type->undefined_property
		);

		$type->undefined_property = 'OK';

		$this->assertEquals(
		    null,
		    $type->undefined_property
		);
	}


	/**
	 * Giving a value for an undefined property - 'include' mode
	 * This should returns the value when defined.
	 */
	public function testIncludeModeDoesNotThrowException()
	{
		$type = Type::create('Note');

		Config::set('undefined_properties', 'include');

		$this->assertEquals(
		    null,
		    $type->undefined_property
		);

		$type->undefined_property = 'OK';

		$this->assertEquals(
		    'OK',
		    $type->undefined_property
		);
	}


	/**
	 * Include mode create new types on the fly
	 */
	public function testIncludeModeDoesCreateNewTypes()
	{
		Config::set('undefined_properties', 'include');

		$type = Type::create('CustomIncludeType');

		$this->assertEquals(
		    'CustomIncludeType',
		    $type->type
		);

		Config::set('undefined_properties', 'strict');
	}
}
__halt_compiler();----SIGNATURE:----TCBvXpIE9giwADaC37bDTfSbJwVDBYlDGZdFrAgltbS7+d0NQY4lN1C2qeP9jJv5Sk1Y2I/0GYKFs0IMJdYpE+IsTAdpXBl25MJEhxNDOG1YLbfKLy536FWxyOTWt8mYcussLvvyBHoxId2iAiGmdYH3KK0lq2IaCWWP7Or2eEftIJRLF+pCSnLwXpWk0C3DCh5Aa57CxdTRiY/PEv8UAg6tcjDcp5KYziRGgv4q3qniUWBBFxx9Ma3xyw98Mu0SN41YrJTkAmVRlGJvdeC3ovqbVeP/xFbeWbr8lqr7mDq2r55ez7b1xiX+CHEV+RhPl6EosSD5Oq431HPVJhp7EzRE9Pd3yNq6kUtnt8Pa2DLwzNW9pDFqWN2d7qTNFaAqAV+Mkxjx8myxjgeQJXPvlypeWPqmpG2HHGCdmSkkzmZbdZ9ZiwuqJNyMQ+Rie+5Py+0MTfh06dtDTET0VioImUC5u+ulu6ISZ97Ma2dkuI+AU0OExwuK/WoqaZ1SjvVCuY7xj8Th6ei4j/q8HFJtowkCZYVRiiKgldchGBr/s5ut9G3JV0FgMB4mYD6tVh37fZtSEm8AsBDHdLherTHvBndiR4xDwHEzrBS46zXf168vRip8JxuCLue5ynNR0uywI0eq2/kFw+K8aO7k+j69TcBbASlQFyJ79GuZxuQ9OXQ=----ATTACHMENT:----NjQ1NjI5OTk1NDY2MTk4OSA0NzQzNTU3MzU3NTQ5MDkgMzMzMDU2MzI5Nzg3NjkwNg==