<commit_before><commit_msg>Added tests for Index class<commit_after><?php

namespace Rentgen\Tests\Database\Constraint;

use Rentgen\Database\Index;
use Rentgen\Database\Table;

/**
 * @author <NAME> <<EMAIL>>
 */
class IndexTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        $this->indexSingleColumn = new Index('foo', new Table('test'));
        $this->indexMultiColumns = new Index(array('foo', 'bar'), new Table('test'));
    }    

    public function testGetName()
    {
        $this->assertSame('test_foo_idx', $this->indexSingleColumn->getName());
        $this->assertSame('test_foo_bar_idx', $this->indexMultiColumns->getName());
    }

    public function testGetColumns()
    {
        $this->assertSame(array('foo'), $this->indexSingleColumn->getColumns());
        $this->assertSame(array('foo', 'bar'), $this->indexMultiColumns->getColumns());
    }

    public function testGetTable()
    {
        $this->assertEquals(new Table('test'), $this->indexSingleColumn->getTable());
        $this->assertEquals(new Table('test'), $this->indexMultiColumns->getTable());
    }
}
{'fraction_non_alphanumeric': 0.16903914590747332, 'fraction_numerical': 0.0, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '2334853', 'n_tokens_mistral': 328, 'n_tokens_neox': 322, 'n_words': 56}