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

HasAndBelongsToManyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 22
rs 10
c 1
b 1
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testTableNameGeneration() 0 18 1
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