@@ -75,4 +75,40 @@ public function testChainedBadPath(): void
7575 }
7676 }
7777 }
78+
79+ public function testOleFunctions (): void
80+ {
81+ $ ole = new OLE ();
82+ $ infile = 'tests/data/Reader/XLS/pr.4687.excel.xls ' ;
83+ $ ole ->read ($ infile );
84+ self ::assertSame (4 , $ ole ->ppsTotal ());
85+ self ::assertFalse ($ ole ->isFile (0 ), 'root entry ' );
86+ self ::assertTrue ($ ole ->isFile (1 ), 'workbook ' );
87+ self ::assertTrue ($ ole ->isFile (2 ), 'summary information ' );
88+ self ::assertTrue ($ ole ->isFile (3 ), 'document summary information ' );
89+ self ::assertFalse ($ ole ->isFile (4 ), 'no such index ' );
90+ self ::assertTrue ($ ole ->isRoot (0 ), 'root entry ' );
91+ self ::assertFalse ($ ole ->isRoot (1 ), 'workbook ' );
92+ self ::assertFalse ($ ole ->isRoot (2 ), 'summary information ' );
93+ self ::assertFalse ($ ole ->isRoot (3 ), 'document summary information ' );
94+ self ::assertFalse ($ ole ->isRoot (4 ), 'no such index ' );
95+ self ::assertSame (0 , $ ole ->getDataLength (0 ), 'root entry ' );
96+ self ::assertSame (15712 , $ ole ->getDataLength (1 ), 'workbook ' );
97+ self ::assertSame (4096 , $ ole ->getDataLength (2 ), 'summary information ' );
98+ self ::assertSame (4096 , $ ole ->getDataLength (3 ), 'document summary information ' );
99+ self ::assertSame (0 , $ ole ->getDataLength (4 ), 'no such index ' );
100+ self ::assertSame ('' , $ ole ->getData (2 , -1 , 4 ), 'negative position ' );
101+ self ::assertSame ('' , $ ole ->getData (2 , 5000 , 4 ), 'position > length ' );
102+ self ::assertSame ('feff0000 ' , bin2hex ($ ole ->getData (2 , 0 , 4 )));
103+ self ::assertSame ('' , $ ole ->getData (4 , 0 , 4 ), 'no such index ' );
104+ }
105+
106+ public function testBadEndian (): void
107+ {
108+ $ this ->expectException (ReaderException::class);
109+ $ this ->expectExceptionMessage ('Only Little-Endian encoding is supported ' );
110+ $ ole = new OLE ();
111+ $ infile = 'tests/data/Reader/XLS/pr.4687.excel.badendian.xls ' ;
112+ $ ole ->read ($ infile );
113+ }
78114}
0 commit comments