Skip to content

Commit 1a13e7f

Browse files
committed
Add unit testing to prevent regressions
1 parent c4cc695 commit 1a13e7f

File tree

6 files changed

+31
-23
lines changed

6 files changed

+31
-23
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"require": {
1515
"php": "^5.6|^7.0"
1616
},
17+
"require-dev": {
18+
"phpunit/phpunit": "^5.7"
19+
},
1720
"autoload": {
1821
"classmap": ["lib/"],
1922
"files": ["lib/common/customFunctions.php"]

index.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<phpunit bootstrap="tests/bootstrap.php">
2+
<testsuite>
3+
<directory suffix="Test.php">tests</directory>
4+
</testsuite>
5+
<filter>
6+
<whitelist processUncoveredFilesFromWhitelist="true">
7+
<directory suffix=".php">src</directory>
8+
</whitelist>
9+
</filter>
10+
</phpunit>

tests/QrReaderTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Khanamiryan\QrCodeTests;
4+
5+
class QrReaderTest extends \PHPUnit_Framework_TestCase
6+
{
7+
8+
public function testText1()
9+
{
10+
$image = __DIR__ . "/qrcodes/hello_world.png";
11+
12+
$qrcode = new \QrReader($image);
13+
$this->assertSame("Hello world!", $qrcode->text());
14+
}
15+
}

tests/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
require __DIR__ . "/../vendor/autoload.php";
File renamed without changes.

0 commit comments

Comments
 (0)