<commit_before><?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace MaglBlogTest\Options;

/**
 * Description of MaglBlogOptionsTest
 *
 * @author matthias
 */
class MaglBlogOptionsTest extends \PHPUnit_Framework_TestCase
{

	public function testShippedConfigOK()
	{

		$sm = \MaglBlogTest\Bootstrap::getServiceManager();
		$config = $sm->get('config');

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions($config['magl_blog']);

		$this->assertTrue(is_array($blogOptions->getTagCloud()));
	}

	public function testTagCloudWidgetNoArrayGiven()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$this->setExpectedException('InvalidArgumentException');

		$blogOptions->setTagCloud('no array');
	}

	public function testTagCloudWidgetMissingTagDecorator()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$this->setExpectedException('InvalidArgumentException');

		$blogOptions->setTagCloud(array(
			'cloudDecorator' => array(
				'foo' => 'bar',
			)
		));
	}

	public function testTagCloudWidgetMissingCloudDecorator()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$this->setExpectedException('InvalidArgumentException');

		$blogOptions->setTagCloud(array(
			'tagDecorator' => array(
				'foo' => 'bar',
			)
		));
	}

	public function testSetGetRecentPostsNum()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$postsNum = 5;

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$blogOptions->setRecentPostsNum($postsNum);
		$this->assertEquals($postsNum, $blogOptions->getRecentPostsNum());
	}<commit_msg>add test for archive widget limit use random numbers for option tests <commit_after><?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace MaglBlogTest\Options;

/**
 * Description of MaglBlogOptionsTest
 *
 * @author matthias
 */
class MaglBlogOptionsTest extends \PHPUnit_Framework_TestCase
{

	public function testShippedConfigOK()
	{

		$sm = \MaglBlogTest\Bootstrap::getServiceManager();
		$config = $sm->get('config');

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions($config['magl_blog']);

		$this->assertTrue(is_array($blogOptions->getTagCloud()));
	}

	public function testTagCloudWidgetNoArrayGiven()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$this->setExpectedException('InvalidArgumentException');

		$blogOptions->setTagCloud('no array');
	}

	public function testTagCloudWidgetMissingTagDecorator()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$this->setExpectedException('InvalidArgumentException');

		$blogOptions->setTagCloud(array(
			'cloudDecorator' => array(
				'foo' => 'bar',
			)
		));
	}

	public function testTagCloudWidgetMissingCloudDecorator()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$this->setExpectedException('InvalidArgumentException');

		$blogOptions->setTagCloud(array(
			'tagDecorator' => array(
				'foo' => 'bar',
			)
		));
	}

	public function testSetGetRecentPostsNum()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$postsNum = rand(1,100);

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$blogOptions->setRecentPostsNum($postsNum);
		$this->assertEquals($postsNum, $blogOptions->getRecentPostsNum());
	}
    
	public function testSetGetArchiveWidgetLimit()
	{
		$sm = \MaglBlogTest\Bootstrap::getServiceManager();

		$postsNum = rand(1,100);

		$blogOptions = new \MaglBlog\Options\MaglBlogOptions();

		$blogOptions->setArchiveWidgetLimit($postsNum);
		$this->assertEquals($postsNum, $blogOptions->getArchiveWidgetLimit());
	}
{'fraction_non_alphanumeric': 0.13626583791537175, 'fraction_numerical': 0.002151565861821659, 'mean_word_length': 5.358662613981763, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, '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': '2974628', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1283, 'n_words': 227}