BatchWriterTest::testWriteItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
namespace Ddeboer\DataImport\Tests\Writer;
4
5
use Ddeboer\DataImport\Writer\BatchWriter;
6
7
class BatchWriterTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testWriteItem()
10
    {
11
        $delegate = $this->getMock('Ddeboer\DataImport\Writer');
12
        $writer = new BatchWriter($delegate);
13
14
        $delegate->expects($this->once())
15
            ->method('prepare');
16
17
        $delegate->expects($this->never())
18
            ->method('writeItem');
19
20
        $writer->prepare();
21
        $writer->writeItem(['Test']);
22
    }
23
24
    public function testFlush()
25
    {
26
        $delegate = $this->getMock('Ddeboer\DataImport\Writer');
27
        $writer = new BatchWriter($delegate);
28
29
        $delegate->expects($this->exactly(20))
30
            ->method('writeItem');
31
32
        $writer->prepare();
33
34
        for ($i = 0; $i < 20; $i++) {
35
            $writer->writeItem(['Test']);
36
        }
37
    }
38
}
39