bytic /
database
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Nip\Database\Tests\Query; |
||||
| 4 | |||||
| 5 | use Mockery as m; |
||||
| 6 | use Nip\Database\Connections\Connection; |
||||
| 7 | use Nip\Database\Query\Insert; |
||||
| 8 | use Nip\Database\Query\Update; |
||||
| 9 | use Nip\Database\Tests\AbstractTest; |
||||
| 10 | |||||
| 11 | /** |
||||
| 12 | * Class UpdateTest |
||||
| 13 | * @package Nip\Database\Tests\Query |
||||
| 14 | */ |
||||
| 15 | class UpdateTest extends AbstractTest |
||||
| 16 | { |
||||
| 17 | /** |
||||
| 18 | * @var Insert |
||||
| 19 | */ |
||||
| 20 | protected $object; |
||||
| 21 | |||||
| 22 | public function test_null() |
||||
| 23 | { |
||||
| 24 | $this->object->table("table"); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 25 | $this->object->data(["id" => 3, "name" => null]); |
||||
| 26 | |||||
| 27 | static::assertEquals( |
||||
| 28 | "UPDATE `table` SET `id` = 3, `name` = NULL", |
||||
| 29 | $this->object->assemble() |
||||
| 30 | ); |
||||
| 31 | } |
||||
| 32 | |||||
| 33 | protected function setUp(): void |
||||
| 34 | { |
||||
| 35 | parent::setUp(); |
||||
| 36 | $this->object = new Update(); |
||||
|
0 ignored issues
–
show
It seems like
new Nip\Database\Query\Update() of type Nip\Database\Query\Update is incompatible with the declared type Nip\Database\Query\Insert of property $object.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||
| 37 | |||||
| 38 | $adapterMock = m::mock('Nip\Database\Adapters\MySQLi')->makePartial(); |
||||
| 39 | $adapterMock->shouldReceive('cleanData')->andReturnUsing(function ($data) { |
||||
| 40 | return $data; |
||||
| 41 | }); |
||||
| 42 | $manager = new Connection(false); |
||||
|
0 ignored issues
–
show
false of type false is incompatible with the type Closure|PDO expected by parameter $pdo of Nip\Database\Connections\Connection::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 43 | $manager->setAdapter($adapterMock); |
||||
| 44 | $this->object->setManager($manager); |
||||
| 45 | } |
||||
| 46 | } |
||||
| 47 |