Passed
Push — main ( 7a6063...0cf387 )
by Lorenzo
10:35
created

PruneCacheInvalidationDataTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testPruneTables() 0 17 1
1
<?php
2
3
namespace Padosoft\SuperCacheInvalidate\Test\Unit;
4
5
use PHPUnit\Framework\TestCase;
6
use Illuminate\Support\Facades\DB;
7
use Padosoft\SuperCacheInvalidate\Console\PruneCacheInvalidationDataCommand;
8
9
class PruneCacheInvalidationDataTest extends TestCase
10
{
11
    protected PruneCacheInvalidationDataCommand $command;
12
13
    protected function setUp(): void
14
    {
15
        parent::setUp();
16
        $this->command = new PruneCacheInvalidationDataCommand();
17
    }
18
19
    public function testPruneTables(): void
20
    {
21
        // Mock DB queries
22
        DB::shouldReceive('select')
23
            ->times(3)
24
            ->andReturn([
25
                (object)[
26
                    'PARTITION_NAME' => 'p202401',
27
                    'PARTITION_DESCRIPTION' => '202401',
28
                ],
29
            ])
30
        ;
31
32
        DB::shouldReceive('statement')->times(3);
33
34
        // Run the command
35
        $this->command->handle();
36
37
        // Assertions are handled by Mockery expectations
38
    }
39
}
40