Skip to content

Commit bd9c99e

Browse files
committed
changes to phpunit test metadata (jsdoc style to attribute for larger tests)
1 parent c137e05 commit bd9c99e

4 files changed

Lines changed: 9 additions & 85 deletions

File tree

test/integration/ExampleTest.php

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
use Mike42\Escpos\EscposImage;
3+
use PHPUnit\Framework\Attributes\Medium;
34

5+
#[Medium]
46
class ExampleTest extends PHPUnit\Framework\TestCase
57
{
68
/* Verify that the examples don't fizzle out with fatal errors */
@@ -11,9 +13,6 @@ public function setUp(): void
1113
$this -> exampleDir = dirname(__FILE__) . "/../../example/";
1214
}
1315

14-
/**
15-
* @medium
16-
*/
1716
public function testBitImage()
1817
{
1918
$this->markTestSkipped('Not repeatable on Travis CI.');
@@ -22,18 +21,12 @@ public function testBitImage()
2221
$this -> outpTest($outp, "bit-image.bin");
2322
}
2423

25-
/**
26-
* @medium
27-
*/
2824
public function testCharacterEncodings()
2925
{
3026
$outp = $this -> runExample("character-encodings.php");
3127
$this -> outpTest($outp, "character-encodings.bin");
3228
}
3329

34-
/**
35-
* @medium
36-
*/
3730
public function testCharacterTables()
3831
{
3932
$outp = $this -> runExample("character-tables.php");
@@ -49,9 +42,6 @@ private function outpTest($outp, $fn)
4942
$this -> assertEquals($outp, file_get_contents($file));
5043
}
5144

52-
/**
53-
* @medium
54-
*/
5545
public function testDemo()
5646
{
5747
$this->markTestSkipped('Not repeatable on Travis CI.');
@@ -60,9 +50,6 @@ public function testDemo()
6050
$this -> outpTest($outp, "demo.bin");
6151
}
6252

63-
/**
64-
* @medium
65-
*/
6653
public function testGraphics()
6754
{
6855
$this->markTestSkipped('Not repeatable on Travis CI.');
@@ -71,9 +58,6 @@ public function testGraphics()
7158
$this -> outpTest($outp, "graphics.bin");
7259
}
7360

74-
/**
75-
* @medium
76-
*/
7761
public function testReceiptWithLogo()
7862
{
7963
$this->markTestSkipped('Not repeatable on Travis CI.');
@@ -82,54 +66,36 @@ public function testReceiptWithLogo()
8266
$this -> outpTest($outp, "receipt-with-logo.bin");
8367
}
8468

85-
/**
86-
* @medium
87-
*/
8869
public function testQrCode()
8970
{
9071
$outp = $this -> runExample("qr-code.php");
9172
$this -> outpTest($outp, "qr-code.bin");
9273
}
9374

94-
/**
95-
* @medium
96-
*/
9775
public function testBarcode()
9876
{
9977
$outp = $this -> runExample("barcode.php");
10078
$this -> outpTest($outp, "barcode.bin");
10179
}
10280

103-
/**
104-
* @medium
105-
*/
10681
public function testTextSize()
10782
{
10883
$outp = $this -> runExample("text-size.php");
10984
$this -> outpTest($outp, "text-size.bin");
11085
}
11186

112-
/**
113-
* @medium
114-
*/
11587
public function testMarginsAndSpacing()
11688
{
11789
$outp = $this -> runExample("margins-and-spacing.php");
11890
$this -> outpTest($outp, "margins-and-spacing.bin");
11991
}
12092

121-
/**
122-
* @medium
123-
*/
12493
public function testPdf417Code()
12594
{
12695
$outp = $this -> runExample("pdf417-code.php");
12796
$this -> outpTest($outp, "pdf417-code.bin");
12897
}
12998

130-
/**
131-
* @medium
132-
*/
13399
public function testUnifontPrintBuffer()
134100
{
135101
$this->markTestSkipped('Not repeatable on Travis CI.');

test/unit/GdEscposImageTest.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22
use Mike42\Escpos\GdEscposImage;
33
use Mike42\Escpos\EscposImage;
4+
use PHPUnit\Framework\Attributes\Medium;
45

6+
#[Medium]
57
class GdEscposImageTest extends PHPUnit\Framework\TestCase
68
{
79

@@ -15,47 +17,32 @@ public function testGdBadFilename()
1517
$this -> loadAndCheckImg('not a real file.png', 1, 1, null, null);
1618
}
1719

18-
/**
19-
* @medium
20-
*/
2120
public function testGdEmpty()
2221
{
2322
$this -> loadAndCheckImg(null, 0, 0, "", array());
2423
}
2524

26-
/**
27-
* @medium
28-
*/
2925
public function testGdBlack()
3026
{
3127
foreach (array('png', 'jpg', 'gif') as $format) {
3228
$this -> loadAndCheckImg('canvas_black.' . $format, 1, 1, "\x80", array("\x80"));
3329
}
3430
}
3531

36-
/**
37-
* @medium
38-
*/
3932
public function testGdBlackTransparent()
4033
{
4134
foreach (array('png', 'gif') as $format) {
4235
$this -> loadAndCheckImg('black_transparent.' . $format, 2, 2, "\xc0\x00", array("\x80\x80"));
4336
}
4437
}
4538

46-
/**
47-
* @medium
48-
*/
4939
public function testGdBlackWhite()
5040
{
5141
foreach (array('png', 'jpg', 'gif') as $format) {
5242
$this -> loadAndCheckImg('black_white.' . $format, 2, 2, "\xc0\x00", array("\x80\x80"));
5343
}
5444
}
5545

56-
/**
57-
* @medium
58-
*/
5946
public function testGdWhite()
6047
{
6148
foreach (array('png', 'jpg', 'gif') as $format) {

test/unit/ImagickEscposImageTest.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22
use Mike42\Escpos\ImagickEscposImage;
33
use Mike42\Escpos\EscposImage;
4+
use PHPUnit\Framework\Attributes\Medium;
45

6+
#[Medium]
57
class ImagickEscposImageTest extends PHPUnit\Framework\TestCase
68
{
79

@@ -15,57 +17,39 @@ public function testImagickBadFilename()
1517
$this -> loadAndCheckImg('not a real file.png', 1, 1, null, null);
1618
}
1719

18-
/**
19-
* @medium
20-
*/
2120
public function testImagickEmpty()
2221
{
2322
$this -> loadAndCheckImg(null, 0, 0, "", array());
2423
}
2524

26-
/**
27-
* @medium
28-
*/
2925
public function testImagickBlack()
3026
{
3127
foreach (array('png', 'jpg', 'gif') as $format) {
3228
$this -> loadAndCheckImg('canvas_black.' . $format, 1, 1, "\x80", array("\x80"));
3329
}
3430
}
3531

36-
/**
37-
* @medium
38-
*/
3932
public function testImagickBlackTransparent()
4033
{
4134
foreach (array('png', 'gif') as $format) {
4235
$this -> loadAndCheckImg('black_transparent.' . $format, 2, 2, "\xc0\x00", array("\x80\x80"));
4336
}
4437
}
4538

46-
/**
47-
* @medium
48-
*/
4939
public function testImagickBlackWhite()
5040
{
5141
foreach (array('png', 'jpg', 'gif') as $format) {
5242
$this -> loadAndCheckImg('black_white.' . $format, 2, 2, "\xc0\x00", array("\x80\x80"));
5343
}
5444
}
5545

56-
/**
57-
* @medium
58-
*/
5946
public function testImagickBlackWhiteTall()
6047
{
6148
// We're very interested in correct column format chopping here at 8 pixels
6249
$this -> loadAndCheckImg('black_white_tall.png', 2, 16,
6350
"\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x00\x00\x00\x00\x00\x00\x00\x00", array("\xff\xff", "\x00\x00"));
6451
}
6552

66-
/**
67-
* @medium
68-
*/
6953
public function testImagickWhite()
7054
{
7155
foreach (array('png', 'jpg', 'gif') as $format) {
@@ -76,7 +60,6 @@ public function testImagickWhite()
7660
/**
7761
* PDF test - load tiny PDF and check for well-formedness
7862
* These are also skipped if you don't have imagick
79-
* @medium
8063
*/
8164
public function testPdfAllPages()
8265
{

test/unit/NativeEscposImageTest.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22
use Mike42\Escpos\NativeEscposImage;
33
use Mike42\Escpos\EscposImage;
4+
use PHPUnit\Framework\Attributes\Medium;
45

6+
#[Medium]
57
class NativeEscposImageTest extends PHPUnit\Framework\TestCase
68
{
79
/**
@@ -14,49 +16,35 @@ public function testBadFilename()
1416
$this -> loadAndCheckImg('not a real file.png', 1, 1, null, null);
1517
}
1618

17-
/**
18-
* @medium
19-
*/
19+
2020
public function testBlack()
2121
{
2222
foreach (array('bmp', 'gif', 'png') as $format) {
2323
$this -> loadAndCheckImg('canvas_black.' . $format, 1, 1, "\x80", array("\x80"));
2424
}
2525
}
2626

27-
/**
28-
* @medium
29-
*/
3027
public function testBlackTransparent()
3128
{
3229
foreach (array('gif', 'png') as $format) {
3330
$this -> loadAndCheckImg('black_transparent.' . $format, 2, 2, "\xc0\x00", array("\x80\x80"));
3431
}
3532
}
3633

37-
/**
38-
* @medium
39-
*/
4034
public function testBlackWhite()
4135
{
4236
foreach (array('bmp', 'png', 'gif') as $format) {
4337
$this -> loadAndCheckImg('black_white.' . $format, 2, 2, "\xc0\x00", array("\x80\x80"));
4438
}
4539
}
4640

47-
/**
48-
* @medium
49-
*/
5041
public function testBlackWhiteTall()
5142
{
5243
// We're very interested in correct column format chopping here at 8 pixels
5344
$this -> loadAndCheckImg('black_white_tall.png', 2, 16,
5445
"\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x00\x00\x00\x00\x00\x00\x00\x00", array("\xff\xff", "\x00\x00"));
5546
}
5647

57-
/**
58-
* @medium
59-
*/
6048
public function testWhite()
6149
{
6250
foreach (array('bmp', 'png', 'gif') as $format) {

0 commit comments

Comments
 (0)