assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table', $oTable); $this->assertEquals($oTable->getStyle(), null); $this->assertEquals($oTable->getWidth(), null); $this->assertEquals($oTable->getRows(), array()); $this->assertCount(0, $oTable->getRows()); } /** * Get style name */ public function testStyleText() { $oTable = new Table('section', 1, 'tableStyle'); $this->assertEquals($oTable->getStyle(), 'tableStyle'); } /** * Get style array */ public function testStyleArray() { $oTable = new Table( 'section', 1, array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80) ); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Table', $oTable->getStyle()); } /** * Set/get width */ public function testWidth() { $oTable = new Table('section', 1); $iVal = rand(1, 1000); $oTable->setWidth($iVal); $this->assertEquals($oTable->getWidth(), $iVal); } /** * Add/get row */ public function testRow() { $oTable = new Table('section', 1); $element = $oTable->addRow(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Row', $element); $this->assertCount(1, $oTable->getRows()); } /** * Add cell */ public function testCell() { $oTable = new Table('section', 1); $oTable->addRow(); $element = $oTable->addCell(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Table\\Cell', $element); } }