<commit_before><?php
namespace Everyman\Neo4j\Cache;

class MemcachedTest extends \PHPUnit_Framework_TestCase
{
	protected $memcached = null;
	protected $cache = null;

	public function setUp()
	{
		$this->memcached = $this->getMock('\Memcached');
		$this->cache = new Memcached($this->memcached);
	}

	public function testSet_PassesThroughToMemcached()
	{
		$this->memcached->expects($this->once())
			->method('set')
			->with('somekey', 'somevalue', 12345)
			->will($this->returnValue(true));

		$this->assertTrue($this->cache->set('somekey', 'somevalue', 12345));
	}

	public function testGet_PassesThroughToMemcached()
	{
		$this->memcached->expects($this->once())
			->method('get')
			->with('somekey')
			->will($this->returnValue('somevalue'));

		$this->assertEquals('somevalue', $this->cache->get('somekey'));
	}

	public function testDelete_PassesThroughToMemcached()
	{
		$this->memcached->expects($this->once())
			->method('delete')
			->with('somekey')<commit_msg>Do not run Memcached tests unless the extension is installed and enabled.<commit_after><?php
namespace Everyman\Neo4j\Cache;

class MemcachedTest extends \PHPUnit_Framework_TestCase
{
	protected $memcached = null;
	protected $cache = null;

	public function setUp()
	{
		if (!phpversion('memcached')) {
			$this->markTestSkipped('Memcached extension not enabled/installed');
		}

		$this->memcached = $this->getMock('\Memcached');
		$this->cache = new Memcached($this->memcached);
	}

	public function testSet_PassesThroughToMemcached()
	{
		$this->memcached->expects($this->once())
			->method('set')
			->with('somekey', 'somevalue', 12345)
			->will($this->returnValue(true));

		$this->assertTrue($this->cache->set('somekey', 'somevalue', 12345));
	}

	public function testGet_PassesThroughToMemcached()
	{
		$this->memcached->expects($this->once())
			->method('get')
			->with('somekey')
			->will($this->returnValue('somevalue'));

		$this->assertEquals('somevalue', $this->cache->get('somekey'));
	}

	public function testDelete_PassesThroughToMemcached()
	{
		$this->memcached->expects($this->once())
			->method('delete')
			->with('somekey')
{'fraction_non_alphanumeric': 0.18612283169245195, 'fraction_numerical': 0.010314111579934365, 'mean_word_length': 5.447129909365559, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 62, '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': '6124501', 'n_tokens_mistral': 775, 'n_tokens_neox': 695, 'n_words': 112}