blob: 8fde6ded69031c8d5821ec9ce6c9af0cfc8dfb3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
namespace PHPExcelFixer\StyleFixer\Plugin;
class ConditionalFormatFixerTest extends BasePluginTest
{
public function test_execute()
{
$output = $this->getMock('\ZipArchive');
$template = $this->getMock('\ZipArchive');
$bookUtil = $this->createBookUtil(2, ['Sheet1' => 'xl/worksheets/sheet1.xml', 'Sheet2' => 'xl/worksheets/sheet2.xml']);
$output
->expects($this->exactly(2))
->method('getFromName')
->with($this->logicalOr('xl/worksheets/sheet1.xml', 'xl/worksheets/sheet2.xml'))
->will($this->returnCallback([$this, 'getOutputXml']))
;
$template
->expects($this->once())
->method('getFromName')
->with($this->equalTo('xl/worksheets/sheet2.xml'))
->will($this->returnCallback([$this, 'getTemplateXml']))
;
$output
->expects($this->once())
->method('addFromString')
->with($this->equalTo('xl/worksheets/sheet2.xml'), $this->callback([$this, 'assertXmlHasExpectedContent']))
;
$fixer = new ConditionalFormatFixer($bookUtil);
$fixer->execute($output, $template);
}
public function assertXmlHasExpectedContent($xml)
{
$this->assertContains('<conditionalFormatting><font/></conditionalFormatting>', $xml);
$this->assertNotContains('<conditionalFormatting/>', $xml);
return true;
}
}
|