summaryrefslogtreecommitdiffstats
path: root/tests/Plugin/ConditionalFormatFixerTest.php
diff options
context:
space:
mode:
authorh-hishida <h-hishida@quartetcom.co.jp>2015-04-28 09:45:00 +0900
committerh-hishida <h-hishida@quartetcom.co.jp>2015-04-28 09:45:00 +0900
commit373ae12ca5db9837f84fef44f3f7077e766aca08 (patch)
treec515f2cccceaa886282ac40f89785da072a3627e /tests/Plugin/ConditionalFormatFixerTest.php
downloadPHPExcelFixer.StyleFixer-373ae12ca5db9837f84fef44f3f7077e766aca08.zip
PHPExcelFixer.StyleFixer-373ae12ca5db9837f84fef44f3f7077e766aca08.tar.gz
PHPExcelFixer.StyleFixer-373ae12ca5db9837f84fef44f3f7077e766aca08.tar.bz2
initial commit
Diffstat (limited to 'tests/Plugin/ConditionalFormatFixerTest.php')
-rw-r--r--tests/Plugin/ConditionalFormatFixerTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/Plugin/ConditionalFormatFixerTest.php b/tests/Plugin/ConditionalFormatFixerTest.php
new file mode 100644
index 0000000..e0d97ac
--- /dev/null
+++ b/tests/Plugin/ConditionalFormatFixerTest.php
@@ -0,0 +1,44 @@
+<?php
+
+
+namespace PHPExcel\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;
+ }
+}