assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); $this->assertEquals($src, $oObject->getSource()); } /** * Create new instance with non-supported files * * @expectedException \PhpOffice\PhpWord\Exception\InvalidObjectException */ public function testConstructWithNotSupportedFiles() { $src = __DIR__ . '/../_files/xsl/passthrough.xsl'; $oObject = new Object($src); $oObject->getSource(); } /** * Create with style */ public function testConstructWithSupportedFilesAndStyle() { $src = __DIR__ . '/../_files/documents/sheet.xls'; $oObject = new Object($src, array('width' => '230px')); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Object', $oObject); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oObject->getStyle()); $this->assertEquals($src, $oObject->getSource()); } /** * Set/get relation Id */ public function testRelationId() { $src = __DIR__ . '/../_files/documents/sheet.xls'; $oObject = new Object($src); $iVal = rand(1, 1000); $oObject->setRelationId($iVal); $this->assertEquals($iVal, $oObject->getRelationId()); } /** * Set/get image relation Id */ public function testImageRelationId() { $src = __DIR__ . '/../_files/documents/sheet.xls'; $oObject = new Object($src); $iVal = rand(1, 1000); $oObject->setImageRelationId($iVal); $this->assertEquals($iVal, $oObject->getImageRelationId()); } }