FileContentReaderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A etagShouldChange() 0 15 1
1
<?php
2
3
/**
4
 * @author    Markus Tacker <[email protected]>
5
 * @copyright 2013-2016 Verein zur Förderung der Netzkultur im Rhein-Main-Gebiet e.V. | http://netzkultur-rheinmain.de/
6
 */
7
8
namespace BCRM\BackendBundle\Tests\Unit\Content;
9
10
class FileContentReaderTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @test
14
     * @group unit
15
     */
16
    public function etagShouldChange()
17
    {
18
        $tempfile = new \SplFileInfo(tempnam(sys_get_temp_dir(), 'fcrtest'));
19
        $fp       = fopen($tempfile, 'a+');
20
        fputs($fp, 'a');
21
        fclose($fp);
22
        $fcr1  = new \BCRM\BackendBundle\Content\FileContentReader(dirname($tempfile->getPathname()), '/content');
23
        $info1 = $fcr1->getInfo($tempfile->getFilename());
24
        $fp    = fopen($tempfile, 'a+');
25
        fputs($fp, 'b');
26
        fclose($fp);
27
        $fcr2  = new \BCRM\BackendBundle\Content\FileContentReader(dirname($tempfile->getPathname()), '/content');
28
        $info2 = $fcr2->getInfo($tempfile->getFilename());
29
        $this->assertNotEquals($info1->getEtag(), $info2->getEtag());
30
    }
31
}
32