Passed
Pull Request — master (#34)
by Marc
05:44
created

SumTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSum() 0 15 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Aggregation;
5
6
use TBolier\RethinkQL\IntegrationTest\Query\AbstractTableTest;
7
use TBolier\RethinkQL\Response\ResponseInterface;
8
9
class SumTest extends AbstractTableTest
10
{
11
    /**
12
     * @return void
13
     * @throws \Exception
14
     */
15
    public function testSum(): void
16
    {
17
        $this->insertDocumentWithNumber(5, 5);
18
        $this->insertDocumentWithNumber(4, 10);
19
        $this->insertDocumentWithNumber(3, 15);
20
        $this->insertDocumentWithNumber(2, 20);
21
        $this->insertDocumentWithNumber(1, 25);
22
23
        /** @var ResponseInterface $res */
24
        $res = $this->r()
25
            ->table('tabletest')
26
            ->sum('number')
27
            ->run();
28
29
        $this->assertEquals(75, $res->getData());
30
    }
31
}
32