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