2023-05-10 13:39:12 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Khanamiryan\QrCodeTests;
|
|
|
|
|
2023-11-02 14:13:04 +08:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2023-05-10 13:39:12 +08:00
|
|
|
use Zxing\QrReader;
|
|
|
|
|
2023-11-02 14:13:04 +08:00
|
|
|
class QrReaderTest extends TestCase
|
2023-05-10 13:39:12 +08:00
|
|
|
{
|
2023-11-02 14:13:04 +08:00
|
|
|
public function testText1()
|
|
|
|
{
|
|
|
|
$image = __DIR__ . "/qrcodes/hello_world.png";
|
2023-05-10 13:39:12 +08:00
|
|
|
|
2023-11-02 14:13:04 +08:00
|
|
|
$qrcode = new QrReader($image);
|
|
|
|
$this->assertSame("Hello world!", $qrcode->text());
|
|
|
|
}
|
2023-05-10 13:39:12 +08:00
|
|
|
|
2023-11-02 14:13:04 +08:00
|
|
|
public function testNoText()
|
|
|
|
{
|
|
|
|
$image = __DIR__ . "/qrcodes/empty.png";
|
|
|
|
$qrcode = new QrReader($image);
|
|
|
|
$this->assertSame(false, $qrcode->text());
|
|
|
|
}
|
2023-05-10 13:39:12 +08:00
|
|
|
}
|