Completed
Push — master ( 3feeea...9fb957 )
by David de
04:08
created

BatchWriterTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testWriteItem() 0 14 1
A testFlush() 0 14 2
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