<commit_before><?php
namespace Veles\Tests\Cache;

use Exception;
use Memcached;
use PHPUnit_Framework_TestCase;
use Veles\Cache\Adapters\CacheAdapterInterface;
use Veles\Cache\Adapters\MemcacheAdapter;
use Veles\Cache\Adapters\MemcachedAdapter;

/**
 * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-09-02 at 17:46:39.
 * @group cache
 */
class CacheTest extends PHPUnit_Framework_TestCase
{
	/**
	 * @covers       Veles\Cache\Cache::setAdapter
	 * @dataProvider setAdapterProvider
	 *
	 * @param CacheAdapterInterface $adapter Adapter
	 */
	public function testSetAdapter($adapter)
	{
		$expected = $adapter;
		Cache::setAdapter($adapter);

		$msg = 'Wrong Cache::$adapter property value!';
		$this->assertAttributeEquals(
			$expected, 'adapter', 'Veles\Tests\Cache\Cache', $msg
		);
	}

	public function setAdapterProvider()
	{
		return [
			[MemcacheAdapter::instance()],
			[MemcachedAdapter::instance()]
		];
	}

	/**
	 * @covers Veles\Cache\Cache::getAdapter
	 * @depends testSetAdapter
	 */
	public function testGetAdapter()
	{
		Cache::setAdapter(MemcacheAdapter::instance());
		$result = Cache::getAdapter();

		$this->assertTrue($result instanceof MemcacheAdapter);

		Cache::setAdapter(MemcachedAdapter::instance());
		$result = Cache::getAdapter();

		$this->assertTrue($result instanceof MemcachedAdapter);
	}

	/**
	 * @covers Veles\Cache\Cache::getAdapter
	 * @expectedException Exception<commit_msg>Remove Memcache usage in unit-tests<commit_after><?php
namespace Veles\Tests\Cache;

use Exception;
use Memcached;
use PHPUnit_Framework_TestCase;
use Veles\Cache\Adapters\CacheAdapterInterface;
use Veles\Cache\Adapters\MemcacheAdapter;
use Veles\Cache\Adapters\MemcachedAdapter;

/**
 * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-09-02 at 17:46:39.
 * @group cache
 */
class CacheTest extends PHPUnit_Framework_TestCase
{
	/**
	 * @covers       Veles\Cache\Cache::setAdapter
	 * @dataProvider setAdapterProvider
	 *
	 * @param CacheAdapterInterface $adapter Adapter
	 */
	public function testSetAdapter($adapter)
	{
		$expected = $adapter;
		Cache::setAdapter($adapter);

		$msg = 'Wrong Cache::$adapter property value!';
		$this->assertAttributeEquals(
			$expected, 'adapter', 'Veles\Tests\Cache\Cache', $msg
		);
	}

	public function setAdapterProvider()
	{
		return [
			[MemcachedAdapter::instance()]
		];
	}

	/**
	 * @covers Veles\Cache\Cache::getAdapter
	 * @depends testSetAdapter
	 */
	public function testGetAdapter()
	{
		Cache::setAdapter(MemcachedAdapter::instance());
		$result = Cache::getAdapter();

		$this->assertTrue($result instanceof MemcachedAdapter);
	}

	/**
	 * @covers Veles\Cache\Cache::getAdapter
	 * @expectedException Exception
{'fraction_non_alphanumeric': 0.13187221396731055, 'fraction_numerical': 0.01263001485884101, 'mean_word_length': 4.984444444444445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '6771108', 'n_tokens_mistral': 913, 'n_tokens_neox': 824, 'n_words': 160}