<commit_before><?php

/*
  +------------------------------------------------------------------------+
  | Phalcon Framework                                                      |
  +------------------------------------------------------------------------+
  | Copyright (c) 2011-2012 Phalcon Team (http://www.phalconphp.com)       |
  +------------------------------------------------------------------------+
  | This source file is subject to the New BSD License that is bundled     |
  | with this package in the file docs/LICENSE.txt.                        |
  |                                                                        |
  | If you did not receive a copy of the license and are unable to         |
  | obtain it through the world-wide-web, please send an email             |
  | to <EMAIL> so we can send you a copy immediately.       |
  +------------------------------------------------------------------------+
  | Authors: <NAME> <<EMAIL>>                      |
  |          <NAME> <<EMAIL>>                         |
  +------------------------------------------------------------------------+
*/

use Phalcon\Mvc\Model\Message as ModelMessage;

class CollectionsTest extends PHPUnit_Framework_TestCase
{

	public function __construct()
	{
		spl_autoload_register(array($this, 'collectionsAutoloader'));
	}

	public function __destruct()
	{
		spl_autoload_unregister(array($this, 'collectionsAutoloader'));
	}

	public function collectionsAutoloader($className)
	{
		if (file_exists('unit-tests/collections/'.$className.'.php')) {
			require 'unit-tests/collections/'.$className.'.php';
		}
	}

	public function testCollections()
	{

		Phalcon\DI::reset();

		$di = new Phalcon\DI();

		$di->set('mongo', function(){
			$mongo = new Mongo('192.168.0.26');
			return $mongo->phalcon_test;
		});

		$di->set('collectionManager', function(){
			return new Phalcon\Mvc\Collection\Manager();
		});

		$songs = Songs::find();
		$this->assertTrue(is_array($songs));

		foreach($songs as $song){
			$this->assertTrue($song->delete());
		}

		$song = new Songs();
		$song->artist = 'Radiohead';
		$song->name = 'Lotus Flower';
		$success = $song->save();
		$this->assertTrue($success);
		$this->assertInstanceOf('MongoId', $song->_id);
		$firstSongId = $song->_id;
<commit_msg>Removing network host for Mongo test<commit_after><?php

/*
  +------------------------------------------------------------------------+
  | Phalcon Framework                                                      |
  +------------------------------------------------------------------------+
  | Copyright (c) 2011-2012 Phalcon Team (http://www.phalconphp.com)       |
  +------------------------------------------------------------------------+
  | This source file is subject to the New BSD License that is bundled     |
  | with this package in the file docs/LICENSE.txt.                        |
  |                                                                        |
  | If you did not receive a copy of the license and are unable to         |
  | obtain it through the world-wide-web, please send an email             |
  | to <EMAIL> so we can send you a copy immediately.       |
  +------------------------------------------------------------------------+
  | Authors: <NAME> <<EMAIL>>                      |
  |          <NAME> <<EMAIL>>                         |
  +------------------------------------------------------------------------+
*/

use Phalcon\Mvc\Model\Message as ModelMessage;

class CollectionsTest extends PHPUnit_Framework_TestCase
{

	public function __construct()
	{
		spl_autoload_register(array($this, 'collectionsAutoloader'));
	}

	public function __destruct()
	{
		spl_autoload_unregister(array($this, 'collectionsAutoloader'));
	}

	public function collectionsAutoloader($className)
	{
		if (file_exists('unit-tests/collections/'.$className.'.php')) {
			require 'unit-tests/collections/'.$className.'.php';
		}
	}

	public function testCollections()
	{

		Phalcon\DI::reset();

		$di = new Phalcon\DI();

		$di->set('mongo', function(){
			$mongo = new Mongo();
			return $mongo->phalcon_test;
		});

		$di->set('collectionManager', function(){
			return new Phalcon\Mvc\Collection\Manager();
		});

		$songs = Songs::find();
		$this->assertTrue(is_array($songs));

		foreach($songs as $song){
			$this->assertTrue($song->delete());
		}

		$song = new Songs();
		$song->artist = 'Radiohead';
		$song->name = '<NAME>';
		$success = $song->save();
		$this->assertTrue($success);
		$this->assertInstanceOf('MongoId', $song->_id);
		$firstSongId = $song->_id;

{'fraction_non_alphanumeric': 0.2790241777390547, 'fraction_numerical': 0.0054454367240252665, 'mean_word_length': 1.4425531914893617, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6177262', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1190, 'n_words': 270}