Completed
Pull Request — master (#2)
by David
02:02
created

TdbmFluidJunctionTableGraphqlOptionsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 7
dl 0
loc 31
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGraphql() 0 28 1
1
<?php
2
3
namespace TheCodingMachine\FluidSchema;
4
5
use Doctrine\DBAL\Schema\Schema;
6
use Doctrine\DBAL\Types\Type;
7
use PHPUnit\Framework\TestCase;
8
9
class TdbmFluidJunctionTableGraphqlOptionsTest extends TestCase
10
{
11
    public function testGraphql()
12
    {
13
        $schema = new Schema();
14
        $fluid = new TdbmFluidSchema($schema);
15
16
        $fluid->table('posts')->uuid();
17
        $fluid->table('users')->uuid();
18
19
        $junctionTableOptions = $fluid->junctionTable('posts', 'users');
20
        $graphqlOptions = $junctionTableOptions->graphql();
21
22
        $graphqlOptions->logged(true)
23
                       ->right('CAN_EDIT')
24
                       ->failWith(null);
25
26
        $this->assertSame("\n@TheCodingMachine\GraphQLite\Annotations\Field
27
@TheCodingMachine\GraphQLite\Annotations\Logged
28
@TheCodingMachine\GraphQLite\Annotations\Right(name=\"CAN_EDIT\")
29
@TheCodingMachine\GraphQLite\Annotations\FailWith(NULL)", $schema->getTable('posts_users')->getOptions()['comment']);
30
31
        $graphqlOptions->logged(false);
32
33
        $this->assertSame("\n@TheCodingMachine\GraphQLite\Annotations\Field
34
@TheCodingMachine\GraphQLite\Annotations\Right(name=\"CAN_EDIT\")
35
@TheCodingMachine\GraphQLite\Annotations\FailWith(NULL)", $schema->getTable('posts_users')->getOptions()['comment']);
36
37
        $this->assertSame($junctionTableOptions, $graphqlOptions->endGraphql());
38
    }
39
}
40