Passed
Branch dev (8d7b92)
by Dispositif
03:12
created

OuvrageCompleteWorkerTest::testRun()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of dispositif/wikibot application
4
 * 2019 © Philippe M. <[email protected]>
5
 * For the full copyright and MIT license information, please view the LICENSE file.
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Application\Tests;
11
12
use App\Application\OuvrageCompleteWorker;
13
use App\Infrastructure\DbAdapter;
14
use PHPUnit\Framework\TestCase;
15
16
require_once __DIR__.'/../myBootstrap.php';
17
18
/**
19
 * Class CompleteProcessTest
20
 *
21
 * @group application
22
 */
23
class OuvrageCompleteWorkerTest extends TestCase
24
{
25
    protected function setUp(): void
26
    {
27
        // todo check ENV
28
        //$this->markTestSkipped('all tests in this file are inactive for this server configuration!');
29
    }
30
31
    public function testRun()
32
    {
33
        $DbAdapterMock = $this->createMock(DbAdapter::class);
34
        $DbAdapterMock->method('getNewRaw')->willReturn(
35
            ['page' => 'bla', 'raw' => '{{Ouvrage |auteur=Pierre André|titre=Bla|}}']
36
        );
37
        $DbAdapterMock->method('sendCompletedData')->willReturn(true);
38
39
        $complete = new OuvrageCompleteWorker($DbAdapterMock, false);
40
41
        $this::assertSame(
42
            true,
43
            $complete->run(1)
44
        );
45
    }
46
47
}
48