Skip to content

Commit 35d976d

Browse files
committed
Fix tests for updated php-shellcommand
1 parent 254c4cf commit 35d976d

File tree

3 files changed

+36
-37
lines changed

3 files changed

+36
-37
lines changed

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
bootstrap="./tests/bootstrap.php"
1312
>
1413
<testsuites>

tests/CommandTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testCanAddFiles()
2929
$this->assertTrue($command->execute($file));
3030
$this->assertFileExists($file);
3131

32-
$this->assertEquals("pdftk A='$document1' B='$document2' input_pw B='complex'\''\"password' output '$file'", (string) $command);
32+
$this->assertEquals("pdftk 'A'='$document1' 'B'='$document2' 'input_pw' 'B'='complex'\''\"password' 'output' '$file'", (string) $command);
3333
}
3434

3535
public function testCanAddOptions()
@@ -45,7 +45,7 @@ public function testCanAddOptions()
4545
$this->assertTrue($command->execute($file));
4646
$this->assertFileExists($file);
4747

48-
$this->assertEquals("pdftk A='$document1' output '$file' encrypt_40bit allow Printing owner_pw 'complex'\''\"password'", (string) $command);
48+
$this->assertEquals("pdftk 'A'='$document1' 'output' '$file' 'encrypt_40bit' allow Printing 'owner_pw' 'complex'\''\"password'", (string) $command);
4949
}
5050

5151
public function testCanSetAndGetOperationAndArgument()
@@ -62,7 +62,7 @@ public function testCanSetAndGetOperationAndArgument()
6262

6363
$this->assertEquals('cat', $command->getOperation());
6464
$this->assertEquals('A', $command->getOperationArgument());
65-
$this->assertEquals("pdftk A='$document1' cat A output '$file'", (string) $command);
65+
$this->assertEquals("pdftk 'A'='$document1' cat A 'output' '$file'", (string) $command);
6666
}
6767

6868
public function testCanAddPageRanges()
@@ -89,7 +89,7 @@ public function testCanAddPageRanges()
8989
$this->assertTrue($command->execute($file));
9090
$this->assertFileExists($file);
9191

92-
$this->assertEquals("pdftk A='$document1' cat 1 A1 1-3 1-3even 1-3evennorth 1-3north A1-3 A1-3even A1-3oddeast A1-3east 1-3east 1 3 A1 A3 output '$file'", (string) $command);
92+
$this->assertEquals("pdftk 'A'='$document1' cat 1 A1 1-3 1-3even 1-3evennorth 1-3north A1-3 A1-3even A1-3oddeast A1-3east 1-3east 1 3 A1 A3 'output' '$file'", (string) $command);
9393
}
9494

9595
protected function getDocument1()

tests/PdfTest.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testCanPassDocumentToConstructor()
2828
$this->assertFileExists($file);
2929

3030
$tmpFile = (string) $pdf->getTmpFile();
31-
$this->assertEquals("pdftk A='$document' output '$tmpFile'", (string) $pdf->getCommand());
31+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile'", (string) $pdf->getCommand());
3232
}
3333
public function testCanPassPdfInstanceToConstructor()
3434
{
@@ -48,7 +48,7 @@ public function testCanPassPdfInstanceToConstructor()
4848
$this->assertFileExists($file);
4949

5050
$tmpFile = (string) $pdf2->getTmpFile();
51-
$this->assertEquals("pdftk A='$outFile1' output '$tmpFile'", (string) $pdf2->getCommand());
51+
$this->assertEquals("pdftk 'A'='$outFile1' 'output' '$tmpFile'", (string) $pdf2->getCommand());
5252
}
5353
public function testCanPassDocumentsToConstructor()
5454
{
@@ -64,7 +64,7 @@ public function testCanPassDocumentsToConstructor()
6464
$this->assertFileExists($file);
6565

6666
$tmpFile = (string) $pdf->getTmpFile();
67-
$this->assertEquals("pdftk A='$document1' B='$document2' output '$tmpFile'", (string) $pdf->getCommand());
67+
$this->assertEquals("pdftk 'A'='$document1' 'B'='$document2' 'output' '$tmpFile'", (string) $pdf->getCommand());
6868
}
6969
public function testCanPassPdfInstancesToConstructor()
7070
{
@@ -94,7 +94,7 @@ public function testCanPassPdfInstancesToConstructor()
9494
$this->assertFileExists($file);
9595

9696
$tmpFile = (string) $pdf->getTmpFile();
97-
$this->assertEquals("pdftk A='$outFile1' B='$outFile2' output '$tmpFile'", (string) $pdf->getCommand());
97+
$this->assertEquals("pdftk 'A'='$outFile1' 'B'='$outFile2' 'output' '$tmpFile'", (string) $pdf->getCommand());
9898
}
9999
public function testCanPassDocumentsWithPasswordToConstructor()
100100
{
@@ -111,7 +111,7 @@ public function testCanPassDocumentsWithPasswordToConstructor()
111111

112112
$tmpFile = (string) $pdf->getTmpFile();
113113
$this->assertEquals(
114-
"pdftk A='$document1' B='$document2' input_pw A='complex'\''\"password' output '$tmpFile'",
114+
"pdftk 'A'='$document1' 'B'='$document2' 'input_pw' 'A'='complex'\''\"password' 'output' '$tmpFile'",
115115
(string) $pdf->getCommand()
116116
);
117117
}
@@ -129,7 +129,7 @@ public function testCanAddFiles()
129129

130130
$tmpFile = (string) $pdf->getTmpFile();
131131
$this->assertEquals(
132-
"pdftk A='$document1' D='$document2' input_pw A='complex'\''\"password' output '$tmpFile'",
132+
"pdftk 'A'='$document1' 'D'='$document2' 'input_pw' 'A'='complex'\''\"password' 'output' '$tmpFile'",
133133
(string) $pdf->getCommand()
134134
);
135135
}
@@ -146,7 +146,7 @@ public function testCanPerformEmptyOperation()
146146

147147
$tmpFile = (string) $pdf->getTmpFile();
148148
$this->assertEquals(
149-
"pdftk A='$document1' input_pw A='complex'\''\"password' output '$tmpFile'",
149+
"pdftk 'A'='$document1' 'input_pw' 'A'='complex'\''\"password' 'output' '$tmpFile'",
150150
(string) $pdf->getCommand()
151151
);
152152
}
@@ -168,7 +168,7 @@ public function testCanCatFile()
168168

169169
$tmpFile = (string) $pdf->getTmpFile();
170170
$this->assertEquals(
171-
"pdftk A='$document' cat 1-5 2 3 4 end-2even 3-5east 4-8eveneast 1south output '$tmpFile'",
171+
"pdftk 'A'='$document' cat 1-5 2 3 4 end-2even 3-5east 4-8eveneast 1south 'output' '$tmpFile'",
172172
(string) $pdf->getCommand()
173173
);
174174
}
@@ -194,7 +194,7 @@ public function testCanCatFiles()
194194

195195
$tmpFile = (string) $pdf->getTmpFile();
196196
$this->assertEquals(
197-
"pdftk A='$document1' B='$document2' cat A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south output '$tmpFile'",
197+
"pdftk 'A'='$document1' 'B'='$document2' cat A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south 'output' '$tmpFile'",
198198
(string) $pdf->getCommand()
199199
);
200200
}
@@ -220,7 +220,7 @@ public function testCanShuffleFiles()
220220

221221
$tmpFile = (string) $pdf->getTmpFile();
222222
$this->assertEquals(
223-
"pdftk A='$document1' B='$document2' shuffle A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south output '$tmpFile'",
223+
"pdftk 'A'='$document1' 'B'='$document2' shuffle A1-5 2 3 4 Bend-2even A3-5east B4-8eveneast A1south 'output' '$tmpFile'",
224224
(string) $pdf->getCommand()
225225
);
226226
}
@@ -290,7 +290,7 @@ public function testCanFillFormFromData()
290290

291291
$tmpFile = (string) $pdf->getTmpFile();
292292
$this->assertRegExp(
293-
"#pdftk A='$form' fill_form '/tmp/[^ ]+\.xfdf' output '$tmpFile' drop_xfa need_appearances#",
293+
"#pdftk 'A'='$form' 'fill_form' '/tmp/[^ ]+\.xfdf' 'output' '$tmpFile' 'drop_xfa' 'need_appearances'#",
294294
(string) $pdf->getCommand()
295295
);
296296
}
@@ -310,7 +310,7 @@ public function testCanFillFormFromFile()
310310

311311
$tmpFile = (string) $pdf->getTmpFile();
312312
$this->assertRegExp(
313-
"#pdftk A='$form' fill_form '$fdf' output '$tmpFile' drop_xfa need_appearances#",
313+
"#pdftk 'A'='$form' 'fill_form' '$fdf' 'output' '$tmpFile' 'drop_xfa' 'need_appearances'#",
314314
(string) $pdf->getCommand()
315315
);
316316
}
@@ -319,15 +319,15 @@ public function testCanUpdateInfo()
319319
{
320320
$document1 = $this->getDocument1();
321321
$file = $this->getOutFile();
322-
322+
323323
$pdf = new Pdf($document1);
324324
$this->assertInstanceOf('mikehaertl\pdftk\Pdf', $pdf->updateInfo([
325325
'Creator' => 'php-pdftk'
326326
]));
327327
$this->assertTrue($pdf->saveAs($file));
328-
328+
329329
$this->assertFileExists($file);
330-
330+
331331
$tmpFile = (string) $pdf->getTmpFile();
332332
$pdf = new Pdf($file);
333333
$data = $pdf->getData();
@@ -346,7 +346,7 @@ public function testCanSetBackground()
346346
$this->assertFileExists($file);
347347

348348
$tmpFile = (string) $pdf->getTmpFile();
349-
$this->assertEquals("pdftk A='$document1' background '$document2' output '$tmpFile'", (string) $pdf->getCommand());
349+
$this->assertEquals("pdftk 'A'='$document1' 'background' '$document2' 'output' '$tmpFile'", (string) $pdf->getCommand());
350350
}
351351

352352
public function testCanSetMultiBackground()
@@ -361,7 +361,7 @@ public function testCanSetMultiBackground()
361361
$this->assertFileExists($file);
362362

363363
$tmpFile = (string) $pdf->getTmpFile();
364-
$this->assertEquals("pdftk A='$document1' multibackground '$document2' output '$tmpFile'", (string) $pdf->getCommand());
364+
$this->assertEquals("pdftk 'A'='$document1' 'multibackground' '$document2' 'output' '$tmpFile'", (string) $pdf->getCommand());
365365
}
366366

367367
public function testCanStamp()
@@ -376,7 +376,7 @@ public function testCanStamp()
376376
$this->assertFileExists($file);
377377

378378
$tmpFile = (string) $pdf->getTmpFile();
379-
$this->assertEquals("pdftk A='$document1' stamp '$document2' output '$tmpFile'", (string) $pdf->getCommand());
379+
$this->assertEquals("pdftk 'A'='$document1' 'stamp' '$document2' 'output' '$tmpFile'", (string) $pdf->getCommand());
380380
}
381381

382382
public function testCanMultiStamp()
@@ -391,7 +391,7 @@ public function testCanMultiStamp()
391391
$this->assertFileExists($file);
392392

393393
$tmpFile = (string) $pdf->getTmpFile();
394-
$this->assertEquals("pdftk A='$document1' multistamp '$document2' output '$tmpFile'", (string) $pdf->getCommand());
394+
$this->assertEquals("pdftk 'A'='$document1' 'multistamp' '$document2' 'output' '$tmpFile'", (string) $pdf->getCommand());
395395
}
396396

397397
public function testCanRemovePermissions()
@@ -405,7 +405,7 @@ public function testCanRemovePermissions()
405405
$this->assertFileExists($file);
406406

407407
$tmpFile = (string) $pdf->getTmpFile();
408-
$this->assertEquals("pdftk A='$document' output '$tmpFile' allow", (string) $pdf->getCommand());
408+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'allow'", (string) $pdf->getCommand());
409409
}
410410

411411
public function testCanSetPermissions()
@@ -419,7 +419,7 @@ public function testCanSetPermissions()
419419
$this->assertFileExists($file);
420420

421421
$tmpFile = (string) $pdf->getTmpFile();
422-
$this->assertEquals("pdftk A='$document' output '$tmpFile' allow Assembly CopyContents", (string) $pdf->getCommand());
422+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' allow Assembly CopyContents", (string) $pdf->getCommand());
423423
}
424424

425425
public function testCanFlatten()
@@ -433,7 +433,7 @@ public function testCanFlatten()
433433
$this->assertFileExists($file);
434434

435435
$tmpFile = (string) $pdf->getTmpFile();
436-
$this->assertEquals("pdftk A='$document' output '$tmpFile' flatten", (string) $pdf->getCommand());
436+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'flatten'", (string) $pdf->getCommand());
437437
}
438438

439439
public function testCanCompress()
@@ -447,7 +447,7 @@ public function testCanCompress()
447447
$this->assertFileExists($file);
448448

449449
$tmpFile = (string) $pdf->getTmpFile();
450-
$this->assertEquals("pdftk A='$document' output '$tmpFile' compress", (string) $pdf->getCommand());
450+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'compress'", (string) $pdf->getCommand());
451451
}
452452

453453
public function testCanUncompress()
@@ -461,7 +461,7 @@ public function testCanUncompress()
461461
$this->assertFileExists($file);
462462

463463
$tmpFile = (string) $pdf->getTmpFile();
464-
$this->assertEquals("pdftk A='$document' output '$tmpFile' uncompress", (string) $pdf->getCommand());
464+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'uncompress'", (string) $pdf->getCommand());
465465
}
466466

467467
public function testCanKeepFirstId()
@@ -475,7 +475,7 @@ public function testCanKeepFirstId()
475475
$this->assertFileExists($file);
476476

477477
$tmpFile = (string) $pdf->getTmpFile();
478-
$this->assertEquals("pdftk A='$document' output '$tmpFile' keep_first_id", (string) $pdf->getCommand());
478+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'keep_first_id'", (string) $pdf->getCommand());
479479
}
480480

481481
public function testCanKeepFinalId()
@@ -489,7 +489,7 @@ public function testCanKeepFinalId()
489489
$this->assertFileExists($file);
490490

491491
$tmpFile = (string) $pdf->getTmpFile();
492-
$this->assertEquals("pdftk A='$document' output '$tmpFile' keep_final_id", (string) $pdf->getCommand());
492+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'keep_final_id'", (string) $pdf->getCommand());
493493
}
494494

495495
public function testCanDropXfa()
@@ -503,7 +503,7 @@ public function testCanDropXfa()
503503
$this->assertFileExists($file);
504504

505505
$tmpFile = (string) $pdf->getTmpFile();
506-
$this->assertEquals("pdftk A='$document' output '$tmpFile' drop_xfa", (string) $pdf->getCommand());
506+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'drop_xfa'", (string) $pdf->getCommand());
507507
}
508508

509509
public function testCanSetPasswords()
@@ -518,7 +518,7 @@ public function testCanSetPasswords()
518518
$this->assertFileExists($file);
519519

520520
$tmpFile = (string) $pdf->getTmpFile();
521-
$this->assertEquals("pdftk A='$document' output '$tmpFile' owner_pw '\"'\''**' user_pw '**\"'\'''", (string) $pdf->getCommand());
521+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'owner_pw' '\"'\''**' 'user_pw' '**\"'\'''", (string) $pdf->getCommand());
522522
}
523523

524524
public function testSet128BitEncryption()
@@ -532,7 +532,7 @@ public function testSet128BitEncryption()
532532
$this->assertFileExists($file);
533533

534534
$tmpFile = (string) $pdf->getTmpFile();
535-
$this->assertEquals("pdftk A='$document' output '$tmpFile' encrypt_128bit", (string) $pdf->getCommand());
535+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'encrypt_128bit'", (string) $pdf->getCommand());
536536
}
537537

538538
public function testSet40BitEncryption()
@@ -546,7 +546,7 @@ public function testSet40BitEncryption()
546546
$this->assertFileExists($file);
547547

548548
$tmpFile = (string) $pdf->getTmpFile();
549-
$this->assertEquals("pdftk A='$document' output '$tmpFile' encrypt_40bit", (string) $pdf->getCommand());
549+
$this->assertEquals("pdftk 'A'='$document' 'output' '$tmpFile' 'encrypt_40bit'", (string) $pdf->getCommand());
550550
}
551551

552552

@@ -656,7 +656,7 @@ protected function getOutFile()
656656
PageMediaRect: 0 0 595 842
657657
PageMediaDimensions: 595 842
658658
EOD;
659-
659+
660660
protected $formDataArray = array(
661661
"Info" => array(
662662
"CreationDate" => "D:20140709121536+02'00'",
@@ -698,7 +698,7 @@ protected function getOutFile()
698698
"Dimensions" => "595 842"
699699
),
700700
)
701-
701+
702702
);
703703

704704
protected $formDataFields = <<<EOD

0 commit comments

Comments
 (0)