mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-18 06:00:19 +00:00
added phpunit
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
install: travis_retry composer install --no-interaction --prefer-source
|
||||
|
||||
script: vendor/bin/phpunit tests --coverage-clover clover.xml --whitelist src
|
||||
|
||||
after_script: bash <(curl -s https://codecov.io/bash)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<testsuites>
|
||||
<testsuite name="php-qrcode test suite">
|
||||
<file>tests/BitBufferTest.php</file>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @filesource BitBufferTest.php
|
||||
* @created 08.02.2016
|
||||
* @author Smiley <smiley@chillerlan.net>
|
||||
* @copyright 2015 Smiley
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
use chillerlan\QRCode\BitBuffer;
|
||||
use chillerlan\QRCode\QRConst;
|
||||
|
||||
class BitBufferTest extends PHPUnit_Framework_TestCase{
|
||||
|
||||
/**
|
||||
* @var \chillerlan\QRCode\BitBuffer
|
||||
*/
|
||||
protected $bitBuffer;
|
||||
|
||||
protected function setUp(){
|
||||
$this->bitBuffer = new BitBuffer;
|
||||
}
|
||||
|
||||
public function bitProvider(){
|
||||
return [
|
||||
[QRConst::MODE_NUMBER, 16],
|
||||
[QRConst::MODE_ALPHANUM, 32],
|
||||
[QRConst::MODE_BYTE, 64],
|
||||
[QRConst::MODE_KANJI, 128],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider bitProvider
|
||||
*/
|
||||
public function testPut($data, $value){
|
||||
$this->bitBuffer->put($data, 4);
|
||||
$this->assertEquals($value, $this->bitBuffer->buffer[0]);
|
||||
$this->assertEquals(4, $this->bitBuffer->length);
|
||||
}
|
||||
|
||||
public function testClear(){
|
||||
$this->bitBuffer->clear();
|
||||
$this->assertEquals([], $this->bitBuffer->buffer);
|
||||
$this->assertEquals(0, $this->bitBuffer->length);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user