Skip to content

Commit

Permalink
Merge pull request #23 from duncan3dc/add-unit-testing
Browse files Browse the repository at this point in the history
Add unit testing to prevent regressions
  • Loading branch information
khanamiryan authored Jan 13, 2017
2 parents c4cc695 + 1a13e7f commit 96d5f80
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"require": {
"php": "^5.6|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"autoload": {
"classmap": ["lib/"],
"files": ["lib/common/customFunctions.php"]
Expand Down
23 changes: 0 additions & 23 deletions index.php

This file was deleted.

10 changes: 10 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<phpunit bootstrap="tests/bootstrap.php">
<testsuite>
<directory suffix="Test.php">tests</directory>
</testsuite>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
15 changes: 15 additions & 0 deletions tests/QrReaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Khanamiryan\QrCodeTests;

class QrReaderTest extends \PHPUnit_Framework_TestCase
{

public function testText1()
{
$image = __DIR__ . "/qrcodes/hello_world.png";

$qrcode = new \QrReader($image);
$this->assertSame("Hello world!", $qrcode->text());
}
}
3 changes: 3 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require __DIR__ . "/../vendor/autoload.php";
File renamed without changes

0 comments on commit 96d5f80

Please sign in to comment.