diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/src/Predefined/Br/LinhaDigitavel.php b/src/Predefined/Br/LinhaDigitavel.php new file mode 100644 index 0000000..f348d8d --- /dev/null +++ b/src/Predefined/Br/LinhaDigitavel.php @@ -0,0 +1,13 @@ +assertContains('.', (new LinhaDigitavel)->getStringMask()); + $this->assertContains('#', (new LinhaDigitavel)->getStringMask()); + $this->assertNotContains('/', (new LinhaDigitavel)->getStringMask()); + $this->assertNotContains('\\', (new LinhaDigitavel)->getStringMask()); + $this->assertNotContains('-', (new LinhaDigitavel)->getStringMask()); + } + + public function provider() + { + return [ + ['00190000090312855701821548161179591160000002222'], + ]; + } + + /** + * @dataProvider provider + */ + public function testMaskDefault($linhaDigitavel) + { + $this->assertContains('.', (new LinhaDigitavel)->mask($linhaDigitavel)->toString()); + $this->assertTrue(strlen($linhaDigitavel) < strlen((new LinhaDigitavel)->mask($linhaDigitavel)->toString())); + } + + /** + * @dataProvider provider + */ + public function testMaskReal($linhaDigitavel) + { + $this->assertContains('.', (new LinhaDigitavel)->mask($linhaDigitavel)->toString()); + $this->assertEquals('00190.00009 03128.557018 21548.161179 5 91160000002222', (new LinhaDigitavel)->mask($linhaDigitavel)->toString()); + } +}