<?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:----FHvw+/KyUIeCoaSg8j0Y3AdRyypWOCC0eqqPhYXI8AdEh00DNnqg6yQo5RfTyn4AZqfGZG8AtsyODBAfITXRJTW1FUa8ws//FZkMDmBWhCyHB7O8h9aI3OatfzJypbOYUcWBCcvUZ5fnrIP6NTT+P99at4oRDModRuM8K5KpU8en3Oghzul/rErFqK2CfeclfxCJ0gBRaR5ylbQPJmMFGyurX50w/g6ejjwEMSwPGDMNKzTwAW6QtNzzsek5mBlNOX02HIygf83mHlaNdUsN9cGCXXnFh9Dooe4Pcw6a7E3A5mdoYUiWGhc2ne6wW8xemnmEx4sr/T3uO6T4Yn4tY4TJUd+pMOtqBzgi8xCoOXjzhIt4ETBpTs9dQ0zo/JJMTGwnkmNSAz0SXaO1yejbTkSESWY3fqDhK7R0QQBP0PEuVuB2gEG7BqQQvW6RjyF5hkCfE5M/9KDhWGB3fNB2cgAPKquvNtrB5QQOoCFxxX6OymIzVHWuMPb+48UwGGzTxqCM8MKmEN6OX6e/89XKR+WgMKcT3MZ2SMsyq6UYyCJYbkm5Epp0E3EOm8nOPcERA9ykI/6BxaKovmVF767aJwKwRprj8FRLJyl5F/Za6sh1W54kX6bUWb7u9jATupKuKpuF7DUZ3DlYgUA0/JrD3znrOEcXCeTikW9ZAuptfcI=----ATTACHMENT:----MTIzNzMzNTAxNzIwMjggNzQ3ODI5NjQ4OTk4NzQzNCA2MzQwMTgyMTE0MTEyNDc0