Exemple #1
0
 public function testWriteFullLabel()
 {
     $localWriteCellStorage = [];
     $label = new Label(Label::FULL);
     $label->setValues([['foo', 'bar', 'baz'], ['foofoo', 'barbar', 'bazbaz']]);
     $cellWorker = $this->getCellWorkerMock();
     $cellWorker->expects($this->exactly(6))->method('writeCell')->will($this->returnCallback(function ($cell, $phpExcelWorsheet, $coordinate) use(&$localWriteCellStorage) {
         $localWriteCellStorage[] = [$cell->getValue(), $coordinate->getXAxis(), $coordinate->getYAxis()];
     }));
     $coordinate = new Coordinate(1, 1);
     $labelWorker = (new LabelWorker($cellWorker))->writeLabel($label, $this->getPhpExcelWorksheetMock(), $coordinate);
     $this->assertEquals(2, $coordinate->getXAxis());
     $this->assertEquals(2, $coordinate->getYAxis());
     $this->assertEquals(2, $coordinate->getOriginalXAxis());
     $this->assertEquals(2, $coordinate->getOriginalYAxis());
     $expected = [['foo', 2, 1], ['bar', 3, 1], ['baz', 4, 1], ['foofoo', 1, 2], ['barbar', 1, 3], ['bazbaz', 1, 4]];
     $this->assertEquals($expected, $localWriteCellStorage);
 }
Exemple #2
0
 public function testInstanciateWithType()
 {
     $label = new Label(Label::LEFT);
     $this->assertEquals(Label::LEFT, $label->getType());
 }