<commit_before><?php

namespace Funstaff\TikaBundle\Tests\Wrapper;

use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Funstaff\TikaBundle\Wrapper\Tika;
use Symfony\Bridge\Monolog\Logger;
use Monolog\Handler\NullHandler;

/**
 * TikaTest
 *
 * @author <NAME> <<EMAIL>>
 */
class TikaTest extends TestCase
{
    public function setup()
    {
        $this->config = array(
            'tika_path' => '/www/bin/tika-app-1.0.jar',
            'output_format' => 'xml',
            'logging' => true);
    }

    public function testWithFailedSetOutputFormat()
    {
        $tika = new Tika($this->config,
            'Funstaff\TikaBundle\Content\Document',
            'Funstaff\TikaBundle\Content\Metadata',
            $this->getLogger());
        try {
            $tika->setOutputFormat('foo');
        } catch (\InvalidArgumentException $e) {
            return;
        }
        $this->fail('Exception on SetOutputFormat with not authorized value');
    }

    public function testSetOutputFormat()
    {
        $tika = new Tika($this->config,
            'Funstaff\TikaBundle\Content\Document',
            'Funstaff\TikaBundle\Content\Metadata',
            $this->getLogger());
        $tika->setOutputFormat('xml');<commit_msg>Changed path on tika binary test config<commit_after><?php

namespace Funstaff\TikaBundle\Tests\Wrapper;

use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Funstaff\TikaBundle\Wrapper\Tika;
use Symfony\Bridge\Monolog\Logger;
use Monolog\Handler\NullHandler;

/**
 * TikaTest
 *
 * @author <NAME> <<EMAIL>>
 */
class TikaTest extends TestCase
{
    public function setup()
    {
        $this->config = array(
            'tika_path' => __DIR__'/../../vendor/tikatika-app-/1.0.jar',
            'output_format' => 'xml',
            'logging' => true);
    }

    public function testWithFailedSetOutputFormat()
    {
        $tika = new Tika($this->config,
            'Funstaff\TikaBundle\Content\Document',
            'Funstaff\TikaBundle\Content\Metadata',
            $this->getLogger());
        try {
            $tika->setOutputFormat('foo');
        } catch (\InvalidArgumentException $e) {
            return;
        }
        $this->fail('Exception on SetOutputFormat with not authorized value');
    }

    public function testSetOutputFormat()
    {
        $tika = new Tika($this->config,
            'Funstaff\TikaBundle\Content\Document',
            'Funstaff\TikaBundle\Content\Metadata',
            $this->getLogger());
        $tika->setOutputFormat('xml');
{'fraction_non_alphanumeric': 0.13623762376237625, 'fraction_numerical': 0.0015841584158415843, 'mean_word_length': 2.408906882591093, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 4}, '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': '4771828', 'n_tokens_mistral': 749, 'n_tokens_neox': 739, 'n_words': 129}