Completed
Push — master ( 3a177f...0ba58c )
by Gabriel
03:15
created

HasAndBelongsToManyTest::testTableNameGeneration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 18
rs 9.4285
c 1
b 1
f 0
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace Nip\Records\Tests\Relations;
4
5
use Nip\Records\RecordManager;
6
use Nip\Records\Relations\HasAndBelongsToMany;
7
8
/**
9
 * Class HasAndBelongsToManyTest
10
 * @package Nip\Records\Tests\Relations
11
 */
12
class HasAndBelongsToManyTest extends \Nip\Records\Tests\AbstractTest
13
{
14
15
    public function testTableNameGeneration()
16
    {
17
        $tableA = new RecordManager();
18
        $tableA->setTable('tableA');
19
20
        $tableB = new RecordManager();
21
        $tableB->setTable('tableB');
22
23
        $relation = new HasAndBelongsToMany();
24
        $relation->setManager($tableA);
25
        $relation->setWith($tableB);
26
        self::assertEquals('tableA_tableB', $relation->getTable());
27
28
        $relation = new HasAndBelongsToMany();
29
        $relation->setManager($tableB);
30
        $relation->setWith($tableA);
31
        self::assertEquals('tableA_tableB', $relation->getTable());
32
    }
33
}
34