<commit_before><?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4; */

/**
 * Testing helper class.
 *
 * PHP version 5
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
 * applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * @package     omeka
 * @subpackage  neatline
 * @author      Scholars' Lab <>
 * @author      <NAME> <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @copyright   2011 The Board and Visitors of the University of Virginia
 * @license     http://www.apache.org/licenses/LICENSE-2.0.html Apache 2 License
 */
?>

<?php

require_once '../NeatlineTimePlugin.php';

class NeatlineTime_Test_AppTestCase extends Omeka_Test_AppTestCase
{

    private $_dbHelper;

    /**
     * Spin up the plugins and prepare the database.
     *
     * @return void.
     */
    public function setUp()
    {

        parent::setUp();

        $this->user = $this->db->getTable('User')->find(1);
        $this->_authenticateUser($this->user);

        // Set up Neatline Time.
        $plugin_broker = get_plugin_broker();
        $this->_addPluginHooksAndFilters($plugin_broker, 'NeatlineTime');
        $plugin_helper = new Omeka_Test_Helper_Plugin;
        $plugin_helper->setUp('NeatlineTime');

        $this->_dbHelper = Omeka_Test_Helper_Db::factory($this->core);

    }

    /**
     * Install the plugin.
     *
     * @return void.
     */
    public function _addPluginHooksAndFilters($plugin_broker, $plugin_name)
    {

        $plugin_broker->setCurrentPluginDirName($plugin_name);
        new NeatlineTimePlugin;

    }

    /**
     * Create a timeline for testing.
     *
     * @return NeatlineTimeTimeline
     */
    public function _createTimeline($data = array())
    {
        if (empty($data)) {
            $data['title'] = 'Timeline Title';
            $data['description'] = 'Timeline description.';
            $data['public'] = '1';
            $data['featured'] = '1';
            $data['creator'] = $this->user->id;
            $data['query'] = array('range' => '1');
        }<commit_msg>Adds user param to _createTimeline.<commit_after><?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4; */

/**
 * Testing helper class.
 *
 * PHP version 5
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
 * applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * @package     omeka
 * @subpackage  neatline
 * @author      Scholars' Lab <>
 * @author      <NAME> <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @copyright   2011 The Board and Visitors of the University of Virginia
 * @license     http://www.apache.org/licenses/LICENSE-2.0.html Apache 2 License
 */
?>

<?php

require_once '../NeatlineTimePlugin.php';

class NeatlineTime_Test_AppTestCase extends Omeka_Test_AppTestCase
{

    private $_dbHelper;

    /**
     * Spin up the plugins and prepare the database.
     *
     * @return void.
     */
    public function setUp()
    {

        parent::setUp();

        $this->user = $this->db->getTable('User')->find(1);
        $this->_authenticateUser($this->user);

        // Set up Neatline Time.
        $plugin_broker = get_plugin_broker();
        $this->_addPluginHooksAndFilters($plugin_broker, 'NeatlineTime');
        $plugin_helper = new Omeka_Test_Helper_Plugin;
        $plugin_helper->setUp('NeatlineTime');

        $this->_dbHelper = Omeka_Test_Helper_Db::factory($this->core);

    }

    /**
     * Install the plugin.
     *
     * @return void.
     */
    public function _addPluginHooksAndFilters($plugin_broker, $plugin_name)
    {

        $plugin_broker->setCurrentPluginDirName($plugin_name);
        new NeatlineTimePlugin;

    }

    /**
     * Create a timeline for testing.
     *
     * @return NeatlineTimeTimeline
     */
    public function _createTimeline($data = array(), $user = null)
    {
        if (empty($data)) {
            $data['title'] = 'Timeline Title';
            $data['description'] = 'Timeline description.';
            $data['public'] = '1';
            $data['featured'] = '1';
            $data['query'] = array('range' => '1');
        }

        $data['creator'] = $user ? $user->id : $this->user->id;
{'fraction_non_alphanumeric': 0.12783586506214242, 'fraction_numerical': 0.007496547642533044, 'mean_word_length': 2.7361827560795873, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5311432', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1488, 'n_words': 414}