Lock file maintenance

This commit is contained in:
CIBot 2025-08-23 15:08:37 +00:00
parent ff31bf599f
commit 3a53c3adc9
326 changed files with 30009 additions and 16 deletions

View file

@ -0,0 +1,33 @@
<?php
/*
* (c) Jeroen van den Enden <info@endroid.nl>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Endroid\QrCode\Tests\Bundle\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class QrCodeControllerTest extends WebTestCase
{
/**
* Tests if the QR code generation route returns a success response.
*/
public function testCreateQrCode()
{
$client = static::createClient();
$client->request('GET', $client->getContainer()->get('router')->generate('endroid_qrcode', [
'text' => 'Life is too short to be generating QR codes',
'extension' => 'png',
'size' => 150,
'label' => 'Dit is een label',
'label_font_size' => 16,
]));
$this->assertEquals(200, $client->getResponse()->getStatusCode());
}
}

View file

@ -0,0 +1,20 @@
<?php
/*
* (c) Jeroen van den Enden <info@endroid.nl>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Endroid\QrCode\Tests\Bundle;
use PHPUnit_Framework_TestCase;
class EndroidQrCodeBundleTest extends PHPUnit_Framework_TestCase
{
public function testNoTestsYet()
{
$this->assertTrue(true);
}
}

View file

@ -0,0 +1,2 @@
/cache
/logs

View file

@ -0,0 +1,36 @@
<?php
/*
* (c) Jeroen van den Enden <info@endroid.nl>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
/**
* {@inheritdoc}
*/
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Endroid\QrCode\Bundle\EndroidQrCodeBundle(),
];
return $bundles;
}
/**
* {@inheritdoc}
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config.yml');
}
}

View file

@ -0,0 +1,7 @@
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../../../vendor/autoload.php';
AnnotationRegistry::registerLoader([$loader, 'loadClass']);

View file

@ -0,0 +1,6 @@
framework:
test: ~
secret: ThisTokenIsNotSoSecretChangeIt
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~

View file

@ -0,0 +1,4 @@
EndroidQrCodeBundle:
resource: "@EndroidQrCodeBundle/Controller/"
type: annotation
prefix: /qrcode

View file

@ -0,0 +1,122 @@
<?php
/*
* (c) Jeroen van den Enden <info@endroid.nl>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Endroid\Tests\QrCode;
use Endroid\QrCode\Exceptions\ImageFunctionFailedException;
use Endroid\QrCode\Exceptions\ImageFunctionUnknownException;
use Endroid\QrCode\QrCode;
use PHPUnit_Framework_TestCase;
class QrCodeTest extends PHPUnit_Framework_TestCase
{
/**
* @var QrCode
*/
protected $qrCode;
/**
* Tests if a valid data uri is returned.
*/
public function testGetDataUri()
{
$qrCode = $this->getQrCode();
$dataUri = $qrCode->getDataUri();
$this->assertTrue(is_string($dataUri));
}
/**
* Tests if a valid image string is returned.
*
* @throws ImageFunctionFailedException
* @throws ImageFunctionUnknownException
*/
public function testGetImageString()
{
$qrCode = $this->getQrCode();
$imageString = $qrCode->get('png');
$this->assertTrue(is_string($imageString));
}
/**
* Tests if a valid image string is returned.
*
* @throws ImageFunctionFailedException
* @throws ImageFunctionUnknownException
*/
public function testGetQrCodeWithLogoString()
{
$qrCode = $this->createQrCodeWithLogo();
$imageString = $qrCode->get('png');
$this->assertTrue(is_string($imageString));
}
/**
* For https://github.com/endroid/QrCode/issues/49.
*/
public function testRenderHttpAddress()
{
$qrCode = new QrCode();
$qrCode
->setText('http://www.example.com/it/it/contact/qr/hit/id/1 ')
->setExtension('png')
->setSize(300)
->setPadding(10)
->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0])
->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0])
->setErrorCorrection(QrCode::LEVEL_MEDIUM);
$qrCode->get('png');
}
/**
* Returns a QR code.
*/
protected function getQrCode()
{
if (!$this->qrCode) {
$this->qrCode = $this->createQrCode();
}
return $this->qrCode;
}
/**
* Creates a QR code.
*
* @return QrCode
*/
protected function createQrCode()
{
$qrCode = new QrCode();
$qrCode->setText('Life is too short to be generating QR codes');
$qrCode->setSize(300);
return $qrCode;
}
/**
* Creates a QR code with a logo.
*
* @return QrCode
*/
protected function createQrCodeWithLogo()
{
$qrCode = new QrCode();
$qrCode->setText('Life is too short to be generating QR codes')
->setSize(300)
->setLogo(dirname(__DIR__).'/assets/image/logo.png')
->setLogoSize(60);
return $qrCode;
}
}