Skip to content

Commit d8574af

Browse files
committed
Added recursive metadata support to CLI client
1 parent a18f5bc commit d8574af

File tree

4 files changed

+67
-86
lines changed

4 files changed

+67
-86
lines changed

scripts/branch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
rm -rf composer.lock
34
rm -rf vendor
45
git checkout $1
56
composer install

tests/BaseTest.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,72 @@ public function testDocumentMetadataKeywords($file)
216216
}
217217
}
218218

219+
/**
220+
* Recursive text metadata test
221+
*
222+
* @dataProvider ocrProvider
223+
*
224+
* @param string $file
225+
* @throws \Exception
226+
*/
227+
public function testTextRecursiveMetadata($file)
228+
{
229+
if(version_compare(self::$version, '1.11') < 0)
230+
{
231+
$this->markTestSkipped('Apache Tika ' . self::$version . ' lacks recursive metadata extraction');
232+
}
233+
else
234+
{
235+
$metadata = self::$client->getRecursiveMetadata($file, 'text');
236+
237+
$this->assertContains('Sed do eiusmod tempor incididunt', $metadata->content);
238+
}
239+
}
240+
241+
/**
242+
* Recursive HTML metadata test
243+
*
244+
* @dataProvider ocrProvider
245+
*
246+
* @param string $file
247+
* @throws \Exception
248+
*/
249+
public function testHtmlRecursiveMetadata($file)
250+
{
251+
if(version_compare(self::$version, '1.11') < 0)
252+
{
253+
$this->markTestSkipped('Apache Tika ' . self::$version . ' lacks recursive metadata extraction');
254+
}
255+
else
256+
{
257+
$metadata = self::$client->getMetadata($file, 'html');
258+
259+
$this->assertContains('Sed do eiusmod tempor incididunt', $metadata->content);
260+
}
261+
}
262+
263+
/**
264+
* Recursive ignore metadata test
265+
*
266+
* @dataProvider ocrProvider
267+
*
268+
* @param string $file
269+
* @throws \Exception
270+
*/
271+
public function testIgnoreRecursiveMetadata($file)
272+
{
273+
if(version_compare(self::$version, '1.11') < 0)
274+
{
275+
$this->markTestSkipped('Apache Tika ' . self::$version . ' lacks recursive metadata extraction');
276+
}
277+
else
278+
{
279+
$metadata = self::$client->getMetadata($file, 'ignore');
280+
281+
$this->assertNull($metadata->content);
282+
}
283+
}
284+
219285
/**
220286
* Language test
221287
*

tests/ErrorTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,6 @@ public function testUnsupportedMedia()
195195
}
196196
}
197197

198-
/**
199-
* Test unsupported command line recursive metadata
200-
*/
201-
public function testUnsupportedCLIRecursiveMetadata()
202-
{
203-
$path = self::getPathForVersion(self::$version);
204-
205-
try
206-
{
207-
$client = Client::make($path);
208-
$client->getMetadata('example.doc', 'html');
209-
210-
$this->fail();
211-
}
212-
catch(Exception $exception)
213-
{
214-
$this->assertContains('Recursive metadata is not supported', $exception->getMessage());
215-
}
216-
}
217-
218198
/**
219199
* Test unknown recursive metadata type
220200
*/

tests/WebTest.php

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -116,72 +116,6 @@ public function testSetRetries()
116116
$this->assertEquals(5, $client->getRetries());
117117
}
118118

119-
/**
120-
* Recursive text metadata test
121-
*
122-
* @dataProvider ocrProvider
123-
*
124-
* @param string $file
125-
* @throws \Exception
126-
*/
127-
public function testTextRecursiveMetadata($file)
128-
{
129-
if(version_compare(self::$version, '1.11') < 0)
130-
{
131-
$this->markTestSkipped('Apache Tika ' . self::$version . ' lacks recursive metadata extraction');
132-
}
133-
else
134-
{
135-
$metadata = self::$client->getRecursiveMetadata($file, 'text');
136-
137-
$this->assertContains('Sed do eiusmod tempor incididunt', $metadata->content);
138-
}
139-
}
140-
141-
/**
142-
* Recursive HTML metadata test
143-
*
144-
* @dataProvider ocrProvider
145-
*
146-
* @param string $file
147-
* @throws \Exception
148-
*/
149-
public function testHtmlRecursiveMetadata($file)
150-
{
151-
if(version_compare(self::$version, '1.11') < 0)
152-
{
153-
$this->markTestSkipped('Apache Tika ' . self::$version . ' lacks recursive metadata extraction');
154-
}
155-
else
156-
{
157-
$metadata = self::$client->getMetadata($file, 'html');
158-
159-
$this->assertContains('Sed do eiusmod tempor incididunt', $metadata->content);
160-
}
161-
}
162-
163-
/**
164-
* Recursive ignore metadata test
165-
*
166-
* @dataProvider ocrProvider
167-
*
168-
* @param string $file
169-
* @throws \Exception
170-
*/
171-
public function testIgnoreRecursiveMetadata($file)
172-
{
173-
if(version_compare(self::$version, '1.11') < 0)
174-
{
175-
$this->markTestSkipped('Apache Tika ' . self::$version . ' lacks recursive metadata extraction');
176-
}
177-
else
178-
{
179-
$metadata = self::$client->getMetadata($file, 'ignore');
180-
181-
$this->assertNull($metadata->content);
182-
}
183-
}
184-
185119
/**
186120
* Test delayed check
187121
*/

0 commit comments

Comments
 (0)