This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
168 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- '5.4' | ||
- '5.5' | ||
- '5.6' | ||
- '7.0' | ||
- hhvm | ||
|
||
install: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace BigFish\PDF417\Tests; | ||
|
||
use BigFish\PDF417\DataEncoder; | ||
use BigFish\PDF417\Encoders\TextEncoder; | ||
use BigFish\PDF417\Encoders\NumberEncoder; | ||
use BigFish\PDF417\Encoders\ByteEncoder; | ||
|
||
class DataEncoderTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testStartingSwitchCodeWordIsAddedOnlyForText() | ||
{ | ||
$encoder = new DataEncoder(); | ||
|
||
// When starting with text, the first code word does not need to be the switch | ||
$cw1 = $encoder->encode("ABC123")[0]; | ||
$this->assertNotEquals($cw1, TextEncoder::SWITCH_CODE_WORD); | ||
|
||
// When starting with numbers, we do need to switch | ||
$cw1 = $encoder->encode("123ABC")[0]; | ||
$this->assertEquals($cw1, NumberEncoder::SWITCH_CODE_WORD); | ||
|
||
// Also with bytes | ||
$cw1 = $encoder->encode("\x0B")[0]; | ||
$this->assertEquals($cw1, ByteEncoder::SWITCH_CODE_WORD); | ||
|
||
// Alternate bytes switch code when number of bytes is divisble by 6 | ||
$cw1 = $encoder->encode("\x0B\x0B\x0B\x0B\x0B\x0B")[0]; | ||
$this->assertEquals($cw1, ByteEncoder::SWITCH_CODE_WORD_ALT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters