Completed
Push — master ( 446929...2851ee )
by Dmitry
04:03
created

TarantoolTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test() 0 15 1
A testRepositoryRegistration() 0 5 1
1
<?php
2
3
use Tarantool\Mapper\Mapper;
4
5
use Repositories\NoteRepository;
6
7
class TarantoolTest extends TestSuite
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    public function test()
10
    {
11
        $this->app->dispatch('tarantool.migrate');
0 ignored issues
show
Bug introduced by
The property app does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
12
13
        $mapper = $this->app->get(Mapper::class);
14
        $mapper->getRepository('note')->truncate();
15
        $note = $mapper->getRepository('note')->create('zzz');
16
        $this->assertSame($note->message, 'zzz');
17
18
        $note->message = 'test';
19
        $note->save();
20
21
        $this->assertNotNull($note->id);
22
        $this->assertSame($note->message, 'test');
23
    }
24
25
    public function testRepositoryRegistration()
26
    {
27
        $repository = $this->app->get(NoteRepository::class);
28
        $this->assertSame($this->app->get(Mapper::class), $repository->getMapper());
29
    }
30
}
31