diff --git a/src/Thermal/Model.php b/src/Thermal/Model.php index 7586ea2..6605851 100644 --- a/src/Thermal/Model.php +++ b/src/Thermal/Model.php @@ -19,7 +19,7 @@ class Model /** * Model profile * - * @var \Thermal\Profile\Profile + * @var Profile */ private $profile; @@ -65,7 +65,7 @@ private static function expandCapabilities($model, $capabilities, $data) * * @param string $profile_name * @param array $capabilities - * @return \Thermal\Profile\Profile + * @return Profile */ private static function newProfile($profile_name, $capabilities) { @@ -104,14 +104,23 @@ private static function newProfile($profile_name, $capabilities) default: return new Epson($capabilities); } - } + /** + * Load all models and capabilities and return + * + * @return array + */ private static function loadCapabilities() { return require(__DIR__ . '/resources/capabilities.php'); } + /** + * Get all models and capabilities + * + * @return array + */ public static function getAll() { $data = self::loadCapabilities(); @@ -123,13 +132,20 @@ public static function getAll() return $data['models']; } + /** + * Selected profile name + * + * @return string + */ public function getName() { return $this->profile->getName(); } /** - * @return \Thermal\Profile\Profile + * Selected profile + * + * @return Profile */ public function getProfile() { diff --git a/src/Thermal/resources/capabilities.php b/src/Thermal/resources/capabilities.php index 310a12c..78052e5 100644 --- a/src/Thermal/resources/capabilities.php +++ b/src/Thermal/resources/capabilities.php @@ -144,6 +144,7 @@ 'brand' => 'Dataregis' ], 'daruma' => [ + 'brand' => 'Daruma', 'profile' => 'epson', 'columns' => 48, 'codepage' => 'CP850', @@ -165,6 +166,7 @@ ] ], 'diebold' => [ + 'brand' => 'Diebold', 'profile' => 'daruma', 'codepages' => [ 'ABICOMP' => "\et\x01", diff --git a/tests/Thermal/ModelTest.php b/tests/Thermal/ModelTest.php index c84d6ea..96ed132 100644 --- a/tests/Thermal/ModelTest.php +++ b/tests/Thermal/ModelTest.php @@ -8,8 +8,45 @@ class ModelTest extends \PHPUnit_Framework_TestCase { public function testGetAll() { + $expected = [ + 'MP-5100 TH' => ['brand' => 'Bematech'], + 'MP-4200 TH' => ['brand' => 'Bematech'], + 'MP-20 MI' => ['brand' => 'Bematech'], + 'MP-100S TH' => ['brand' => 'Bematech'], + 'TM-T20' => ['brand' => 'Epson'], + 'TM-T81' => ['brand' => 'Epson'], + 'TM-T88' => ['brand' => 'Epson'], + 'NIX' => ['brand' => 'Elgin'], + 'VOX+' => ['brand' => 'Elgin'], + 'VOX' => ['brand' => 'Elgin'], + 'I9' => ['brand' => 'Elgin'], + 'I7' => ['brand' => 'Elgin'], + 'DS300' => ['brand' => 'Daruma'], + 'DS348' => ['brand' => 'Daruma'], + 'DR600' => ['brand' => 'Daruma'], + 'DR700' => ['brand' => 'Daruma'], + 'DR800' => ['brand' => 'Daruma'], + 'IM113' => ['brand' => 'Diebold'], + 'IM402' => ['brand' => 'Diebold'], + 'IM433' => ['brand' => 'Diebold'], + 'IM453' => ['brand' => 'Diebold'], + 'TSP-143' => ['brand' => 'Diebold'], + 'SI-250' => ['brand' => 'Sweda'], + 'SI-300L' => ['brand' => 'Sweda'], + 'SI-300S' => ['brand' => 'Sweda'], + 'SI-300W' => ['brand' => 'Sweda'], + 'E-3202' => ['brand' => 'Dataregis'], + 'DT200' => ['brand' => 'Dataregis'], + 'IM833' => ['brand' => 'Diebold'], + 'PrintiD' => ['brand' => 'ControliD'], + 'PertoPrinter' => ['brand' => 'Perto'], + 'CMP-20' => ['brand' => 'Citizen'], + ]; $list = Model::getAll(); - $this->assertInternalType('array', $list); + $list = array_map(function ($value) { + return [ 'brand' => $value['brand'] ]; + }, $list); + $this->assertEquals($expected, $list); } public function testGetName()