<commit_before><?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TemplateTest
 *
 * @author matias
 */
namespace ColumnisTest\Model;

use Columnis\Model\Template;
use PHPUnit_Framework_TestCase;

class TemplateTest extends PHPUnit_Framework_TestCase {
    
    public function testConstructor() {
        $template = new Template();
        $this->assertInstanceOf('Columnis\Model\Template', $template);
    }
    
    public function testGetMainFile() {        
        $template = new Template();        
        $path = dirname(__FILE__) . '/../../_files/example-template';
        $template->setPath($path);
        $name = 'example-template';
        $template->setName($name);
        
        $mainFile = Template::MAIN_FILE;
        
        $this->assertEquals($template->getMainFile(), realpath($path . DIRECTORY_SEPARATOR . $mainFile));
        $this->assertEquals($template->getMainFile(false), $name . DIRECTORY_SEPARATOR . $mainFile);
    }
    
    public function testGetDefinitionFile() {        
        $template = new Template();        
        $path = dirname(__FILE__) . '/../../_files/example-template';
        $template->setPath($path);
        $name = 'example-template';
        $template->setName($name);
        
        $definitionFile = Template::DEFINITION_FILE;
        
        $this->assertEquals($template->getDefinitionFile(), realpath($path . DIRECTORY_SEPARATOR . $definitionFile));
    }
    
    /**
     * @covers Template::parseDefinition
     */
    public function testGetParsedDefinition() {        <commit_msg>- Forgot namespace in @cover annotation<commit_after><?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TemplateTest
 *
 * @author matias
 */
namespace ColumnisTest\Model;

use Columnis\Model\Template;
use PHPUnit_Framework_TestCase;

class TemplateTest extends PHPUnit_Framework_TestCase {
    
    public function testConstructor() {
        $template = new Template();
        $this->assertInstanceOf('Columnis\Model\Template', $template);
    }
    
    public function testGetMainFile() {        
        $template = new Template();        
        $path = dirname(__FILE__) . '/../../_files/example-template';
        $template->setPath($path);
        $name = 'example-template';
        $template->setName($name);
        
        $mainFile = Template::MAIN_FILE;
        
        $this->assertEquals($template->getMainFile(), realpath($path . DIRECTORY_SEPARATOR . $mainFile));
        $this->assertEquals($template->getMainFile(false), $name . DIRECTORY_SEPARATOR . $mainFile);
    }
    
    public function testGetDefinitionFile() {        
        $template = new Template();        
        $path = dirname(__FILE__) . '/../../_files/example-template';
        $template->setPath($path);
        $name = 'example-template';
        $template->setName($name);
        
        $definitionFile = Template::DEFINITION_FILE;
        
        $this->assertEquals($template->getDefinitionFile(), realpath($path . DIRECTORY_SEPARATOR . $definitionFile));
    }
    
    /**
     * @covers Columnis\Model\Template::parseDefinition
     */
    public function testGetParsedDefinition() {        
{'fraction_non_alphanumeric': 0.1273300831660453, 'fraction_numerical': 0.0, 'mean_word_length': 2.6523560209424084, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '6077173', 'n_tokens_mistral': 926, 'n_tokens_neox': 917, 'n_words': 199}