Passed
Push — main ( b49db2...9f0690 )
by Sammy
08:20
created

testConstructorThrowsExceptionWhenConditionsAreEmpty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
3
use HexMakina\Crudites\Grammar\Query\Delete;
4
use HexMakina\Crudites\Grammar\Clause\Where;
5
6
class DeleteTest extends TestCase
7
{
8
    public function testConstructorThrowsExceptionWhenConditionsAreEmpty()
9
    {
10
        $this->expectException(\InvalidArgumentException::class);
11
        $this->expectExceptionMessage('DELETE_USED_AS_TRUNCATE');
12
        
13
        new Delete('test_table', []);
14
    }
15
16
    public function testConstructorSetsTableAndConditions()
17
    {
18
        $table = 'test_table';
19
        $conditions = ['id' => 1];
20
        $delete = new Delete($table, $conditions);
21
22
        $this->assertEquals($table, $delete->table());
23
        $this->assertInstanceOf(Where::class, $delete->clause(Where::WHERE));
24
    }
25
    /*
26
    public function testStatement()
27
    {
28
        $table = 'test_table';
29
        $conditions = ['id' => 1];
30
        $delete = new Delete($table, $conditions);
31
32
        $expectedStatement = 'DELETE FROM `test_table` WHERE `id` = :id ';
33
        $this->assertEquals($expectedStatement, $delete->statement());
34
35
        $this->assertEquals(['id' => 1], $delete->bindings());
36
    }
37
/*
38
    public function testBindings()
39
    {
40
        $table = 'test_table';
41
        $conditions = ['id' => 1];
42
        $delete = new Delete($table, $conditions);
43
44
        $expectedBindings = [':id' => 1];
45
        $this->assertEquals($expectedBindings, $delete->bindings());
46
    }
47
        */
48
}