<commit_before><?php

namespace Options;

use Halfpastfour\PHPChartJS\Options\Legend;
use Test\TestUtils;

class LegendTest extends \PHPUnit_Framework_TestCase
{
	private $legend;

	private $input_data = [
		'display'		=> true,
		'position'		=> 'position',
		'fullWidth'		=> true,
		'reverse'		=> true,
	];

	private $empty_data = [
		'display'		=> null,
		'position'		=> null,
		'fullWidth'		=> null,
		'reverse'		=> null,
	];

	public function setUp()
	{
		$this->legend = new Legend();
	}

	public function testEmpty()
	{
		$expected = $this->empty_data;
		$result = TestUtils::getAttributes($this->legend, $this->input_data);
		self::assertSame($expected, $result);
	}

	public function testGetAndSet() {
		$expected = $this->input_data;
		TestUtils::setAttributes($this->legend, $this->input_data);
		$result = TestUtils::getAttributes($this->legend, $this->input_data);
		self::assertSame($expected, $result);
	}<commit_msg>Added test on Expr fields.<commit_after><?php

namespace Options;

use Halfpastfour\PHPChartJS\Options\Legend;
use Test\TestUtils;

class LegendTest extends \PHPUnit_Framework_TestCase
{
	private $legend;

	private $data_types = [
		'display'		=> false,
		'position'		=> '',
		'fullWidth'		=> false,
		'onClick'		=> '',
		'onHover'		=> '',
		'reverse'		=> false,
	];

	private $input_data = [
		'display'		=> true,
		'position'		=> 'position',
		'fullWidth'		=> true,
		'onClick'		=> 'onClick',
		'onHover'		=> 'onData',
		'reverse'		=> true,
	];

	private $empty_data = [
		'display'		=> null,
		'position'		=> null,
		'fullWidth'		=> null,
		'onClick'		=> null,
		'onHover'		=> null,
		'reverse'		=> null,
	];

	public function setUp()
	{
		$this->legend = new Legend();
	}

	public function testEmpty()
	{
		$expected = $this->empty_data;
		$result = TestUtils::getAttributes($this->legend, $this->data_types);
		self::assertSame($expected, $result);
	}

	public function testGetAndSet() {
		$expected = $this->input_data;
		TestUtils::setAttributes($this->legend, $this->input_data);
		$result = TestUtils::getAttributes($this->legend, $this->data_types);
		self::assertSame($expected, $result);
	}
{'fraction_non_alphanumeric': 0.17636022514071295, 'fraction_numerical': 0.0, 'mean_word_length': 4.386363636363637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '1535265', 'n_tokens_mistral': 844, 'n_tokens_neox': 784, 'n_words': 145}