From 598e887680e30ddbc21083b540790db0f4003e41 Mon Sep 17 00:00:00 2001 From: arandilopez Date: Wed, 11 Oct 2017 16:40:41 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Dictionary.php | 39 ++- src/ProfaneServiceProvider.php | 7 +- src/ProfaneValidator.php | 40 ++- src/Str.php | 102 +++--- src/dict/en.php | 2 +- src/dict/it.php | 390 +++++++++++----------- src/dict/nl.php | 2 +- src/dict/sk.php | 96 +++--- src/dict/zh-tw.php | 2 +- src/lang/en/validation.php | 2 +- src/lang/es/validation.php | 2 +- src/lang/nl/validation.php | 4 +- src/lang/pt-br/validation.php | 2 +- src/lang/sk/validation.php | 2 +- src/lang/zh-tw/validation.php | 2 +- tests/DictionaryTest.php | 5 +- tests/ProfaneValidatorTest.php | 12 +- tests/StrTest.php | 1 - tests/Support/ProfaneValidatorBuilder.php | 19 +- tests/TestCase.php | 10 +- 20 files changed, 381 insertions(+), 360 deletions(-) diff --git a/src/Dictionary.php b/src/Dictionary.php index 517fd86..f2a5f48 100644 --- a/src/Dictionary.php +++ b/src/Dictionary.php @@ -7,16 +7,18 @@ use Illuminate\Support\Facades\Config; class Dictionary { /** - * [$dictionary description] + * [$dictionary description]. + * * @var [type] */ private $dictionary; /** - * [__construct description] + * [__construct description]. + * * @param [type] $dictionary [description] */ - function __construct($dictionary = null) + public function __construct($dictionary = null) { // Get default locale string in laravel project // and set it as default dictionary @@ -26,7 +28,8 @@ class Dictionary } /** - * [getDictionary description] + * [getDictionary description]. + * * @return [type] [description] */ public function getDictionary() @@ -35,18 +38,21 @@ class Dictionary } /** - * Set the dictionary to use - * @param array|string $dictionary - */ + * Set the dictionary to use. + * + * @param array|string $dictionary + */ public function setDictionary($dictionary) { $this->dictionary = $this->readDictionary($dictionary); } /** - * [readDictionary description] - * @param [type] $dictionary [description] - * @return [type] [description] + * [readDictionary description]. + * + * @param [type] $dictionary [description] + * + * @return [type] [description] */ protected function readDictionary($dictionary) { @@ -55,23 +61,23 @@ class Dictionary if (is_array($dictionary)) { foreach ($dictionary as $file) { if (file_exists($baseDictPath.$file.'.php')) { - $dict = include($baseDictPath.$file.'.php'); + $dict = include $baseDictPath.$file.'.php'; $words = array_merge($words, $dict); } else { // if the file isn't in the dict directory, // it's probably a custom user library - $dict = include($file); + $dict = include $file; $words = array_merge($words, $dict); } } // just a single string, not an array } elseif (is_string($dictionary)) { if (file_exists($baseDictPath.$dictionary.'.php')) { - $dict = include($baseDictPath.$dictionary.'.php'); + $dict = include $baseDictPath.$dictionary.'.php'; $words = array_merge($words, $dict); } else { if (file_exists($dictionary)) { - $dict = include($dictionary); + $dict = include $dictionary; $words = array_merge($words, $dict); } // else nothing is merged } @@ -81,11 +87,12 @@ class Dictionary } /** - * [getBaseDictPath description] + * [getBaseDictPath description]. + * * @return [type] [description] */ protected function getBaseDictPath() { - return property_exists($this, 'baseDictPath') ? $this->baseDictPath : __DIR__ . DIRECTORY_SEPARATOR .'dict/'; + return property_exists($this, 'baseDictPath') ? $this->baseDictPath : __DIR__.DIRECTORY_SEPARATOR.'dict/'; } } diff --git a/src/ProfaneServiceProvider.php b/src/ProfaneServiceProvider.php index ae41f89..a1e70c1 100644 --- a/src/ProfaneServiceProvider.php +++ b/src/ProfaneServiceProvider.php @@ -1,9 +1,10 @@ dictionary = $dictionary; - $this->badwords = $dictionary->getDictionary(); + $this->badwords = $dictionary->getDictionary(); } /** - * Method to extends to Validator - * @param string $attribute - * @param midex $value - * @param array $parameters - * @param \Illuminate\Contracts\Validation\Validator $validator [description] - * @return bool - */ + * Method to extends to Validator. + * + * @param string $attribute + * @param midex $value + * @param array $parameters + * @param \Illuminate\Contracts\Validation\Validator $validator [description] + * + * @return bool + */ public function validate($attribute, $value, $parameters) { if ($parameters) { @@ -48,10 +52,12 @@ class ProfaneValidator } /** - * Check profanity of text - * @param string $text - * @return bool - */ + * Check profanity of text. + * + * @param string $text + * + * @return bool + */ public function isProfane($text) { return Str::containsCaseless( diff --git a/src/Str.php b/src/Str.php index ac805fe..1a90e75 100644 --- a/src/Str.php +++ b/src/Str.php @@ -5,13 +5,14 @@ namespace LaravelProfane; class Str { /** - * Taken from Illuminate\Support\Str - * Determine if a given string contains a given word with case insensitive match. - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ + * Taken from Illuminate\Support\Str + * Determine if a given string contains a given word with case insensitive match. + * + * @param string $haystack + * @param string|array $needles + * + * @return bool + */ public static function containsCaseless($haystack, $needles) { foreach ((array) $needles as $needle) { @@ -20,59 +21,62 @@ class Str return true; } } + return false; } /** * Remove accents or special characters from a string. - * @param string $string + * + * @param string $string + * * @return string */ public static function removeAccent($string) { $replace = [ - 'ъ'=>'-', 'Ь'=>'-', 'Ъ'=>'-', 'ь'=>'-', - 'Ă'=>'A', 'Ą'=>'A', 'À'=>'A', 'Ã'=>'A', 'Á'=>'A', 'Æ'=>'A', 'Â'=>'A', 'Å'=>'A', 'Ä'=>'Ae', - 'Þ'=>'B', - 'Ć'=>'C', 'ץ'=>'C', 'Ç'=>'C', - 'È'=>'E', 'Ę'=>'E', 'É'=>'E', 'Ë'=>'E', 'Ê'=>'E', - 'Ğ'=>'G', - 'İ'=>'I', 'Ï'=>'I', 'Î'=>'I', 'Í'=>'I', 'Ì'=>'I', - 'Ł'=>'L', - 'Ñ'=>'N', 'Ń'=>'N', - 'Ø'=>'O', 'Ó'=>'O', 'Ò'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'Oe', - 'Ş'=>'S', 'Ś'=>'S', 'Ș'=>'S', 'Š'=>'S', - 'Ț'=>'T', - 'Ù'=>'U', 'Û'=>'U', 'Ú'=>'U', 'Ü'=>'Ue', - 'Ý'=>'Y', - 'Ź'=>'Z', 'Ž'=>'Z', 'Ż'=>'Z', - 'â'=>'a', 'ǎ'=>'a', 'ą'=>'a', 'á'=>'a', 'ă'=>'a', 'ã'=>'a', 'Ǎ'=>'a', 'а'=>'a', 'А'=>'a', 'å'=>'a', 'à'=>'a', 'א'=>'a', 'Ǻ'=>'a', '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u', 'ǚ'=>'u', 'ǜ'=>'u', 'Ǚ'=>'u', 'Ǘ'=>'u', 'ǖ'=>'u', 'ǘ'=>'u', 'ü'=>'ue', + 'в'=> 'v', 'ו'=>'v', 'В'=>'v', + 'ש'=> 'w', 'ŵ'=>'w', 'Ŵ'=>'w', + 'ы'=> 'y', 'ŷ'=>'y', 'ý'=>'y', 'ÿ'=>'y', 'Ÿ'=>'y', 'Ŷ'=>'y', + 'Ы'=> 'y', 'ž'=>'z', 'З'=>'z', 'з'=>'z', 'ź'=>'z', 'ז'=>'z', 'ż'=>'z', 'ſ'=>'z', 'Ж'=>'zh', 'ж'=>'zh', 'ά' => 'α', 'έ' => 'ε', 'ή' => 'η', 'ί' => 'ι', 'ό' => 'ο', 'ύ' => 'υ', 'ώ' => 'ω', ]; return strtr($string, $replace); diff --git a/src/dict/en.php b/src/dict/en.php index e8eb72d..17c4e76 100644 --- a/src/dict/en.php +++ b/src/dict/en.php @@ -77,5 +77,5 @@ return [ 'taint', 'titty', 'vag', - 'whore' + 'whore', ]; diff --git a/src/dict/it.php b/src/dict/it.php index bef52a8..be303e2 100644 --- a/src/dict/it.php +++ b/src/dict/it.php @@ -10,200 +10,200 @@ return [ | */ - "affanculo", - "allupato", - "ammucchiata", - "anale", - "arrapato", - "arrusa", - "arruso", - "assatanato", - "bagascia", - "bagassa", - "bagnarsi", - "baldracca", - "balle", - "battere", - "battona", - "belino", - "biga", - "bocchinara", - "bocchinaro", - "bocchino", - "bofilo", - "boiata", - "bordello", - "brinca", - "bucaiolo", - "budiùlo", - "buona donna", - "busone", - "cacca", - "caccati in mano e prenditi a schiaffi", - "caciocappella", - "cadavere", - "cagare", - "cagata", - "cagna", - "cammello", - "cappella", - "carciofo", - "carità", - "casci", - "cazzata", - "cazzi", - "cazzimma", - "cazzo", - "checca", - "chiappa", - "chiavare", - "chiavata", - "ciospo", - "ciucciami il cazzo", - "coglione", - "coglioni", - "cornuto", - "cozza", - "culattina", - "culattone", - "culo", - "di merda", - "dio bestia", - "dio cane", - "dio porco", - "ditalino", - "duro", - "fanculo", - "fare unaŠ", - "fava", - "femminuccia", - "fica", - "figa", - "figlio di buona donna", - "figlio di puttana", - "figone", - "finocchio", - "fottere", - "fottersi", - "fracicone", - "fregna", - "frocio", - "froscio", - "fuori come un balcone", - "goldone", - "grilletto", - "guanto", - "guardone", - "incazzarsi", - "incoglionirsi", - "inculare", - "ingoio", + 'affanculo', + 'allupato', + 'ammucchiata', + 'anale', + 'arrapato', + 'arrusa', + 'arruso', + 'assatanato', + 'bagascia', + 'bagassa', + 'bagnarsi', + 'baldracca', + 'balle', + 'battere', + 'battona', + 'belino', + 'biga', + 'bocchinara', + 'bocchinaro', + 'bocchino', + 'bofilo', + 'boiata', + 'bordello', + 'brinca', + 'bucaiolo', + 'budiùlo', + 'buona donna', + 'busone', + 'cacca', + 'caccati in mano e prenditi a schiaffi', + 'caciocappella', + 'cadavere', + 'cagare', + 'cagata', + 'cagna', + 'cammello', + 'cappella', + 'carciofo', + 'carità', + 'casci', + 'cazzata', + 'cazzi', + 'cazzimma', + 'cazzo', + 'checca', + 'chiappa', + 'chiavare', + 'chiavata', + 'ciospo', + 'ciucciami il cazzo', + 'coglione', + 'coglioni', + 'cornuto', + 'cozza', + 'culattina', + 'culattone', + 'culo', + 'di merda', + 'dio bestia', + 'dio cane', + 'dio porco', + 'ditalino', + 'duro', + 'fanculo', + 'fare unaŠ', + 'fava', + 'femminuccia', + 'fica', + 'figa', + 'figlio di buona donna', + 'figlio di puttana', + 'figone', + 'finocchio', + 'fottere', + 'fottersi', + 'fracicone', + 'fregna', + 'frocio', + 'froscio', + 'fuori come un balcone', + 'goldone', + 'grilletto', + 'guanto', + 'guardone', + 'incazzarsi', + 'incoglionirsi', + 'inculare', + 'ingoio', "l'arte bolognese", - "leccaculo", - "lecchino", - "lofare", - "loffa", - "loffare", - "lumaca", - "manico", - "mannaggia", - "merda", - "merdata", - "merdoso", - "mignotta", - "minchia", - "minchione", - "mona", - "monta", - "montare", - "mussa", - "nave scuola", - "nerchia", - "nudo", - "padulo", - "palle", - "palloso", - "patacca", - "patonza", - "pecorina", - "pesce", - "picio", - "pincare", - "pipa", - "pippone", - "pipì", - "pirla", - "pisciare", - "piscio", - "pisello", - "pistola", - "pistolotto", - "pomiciare", - "pompa", - "pompinara", - "pompino", - "porca madonna", - "porca miseria", - "porca puttana", - "porca", - "porco dio", - "porco due", - "porco zio", - "potta", - "puppami", - "puttana", - "quaglia", - "recchione", - "regina", - "ricchione", - "rincoglionire", - "rizzarsi", - "rompiballe", - "rottinculo", - "ruffiano", - "sbattere", - "sbattersi", - "sborra", - "sborrata", - "sborrone", - "sbrodolata", - "scopare", - "scopata", - "scorreggiare", - "sega", - "segaiolo", - "slinguare", - "slinguata", - "smandrappata", - "soccia", - "socmel", - "sorca", - "spagnola", - "spompinare", - "sticchio", - "stronza", - "stronzata", - "stronzo", - "succhiami", - "sveltina", - "sverginare", - "tarzanello", - "terrone", - "testa di cazzo", - "tette", - "tirare", - "topa", - "troia", - "troietta", - "troiona", - "troione", - "trombare", - "uccello", - "vacca", - "vaffanculo", - "vangare", - "venire", - "zinne", - "zio cantante", - "zoccola" + 'leccaculo', + 'lecchino', + 'lofare', + 'loffa', + 'loffare', + 'lumaca', + 'manico', + 'mannaggia', + 'merda', + 'merdata', + 'merdoso', + 'mignotta', + 'minchia', + 'minchione', + 'mona', + 'monta', + 'montare', + 'mussa', + 'nave scuola', + 'nerchia', + 'nudo', + 'padulo', + 'palle', + 'palloso', + 'patacca', + 'patonza', + 'pecorina', + 'pesce', + 'picio', + 'pincare', + 'pipa', + 'pippone', + 'pipì', + 'pirla', + 'pisciare', + 'piscio', + 'pisello', + 'pistola', + 'pistolotto', + 'pomiciare', + 'pompa', + 'pompinara', + 'pompino', + 'porca madonna', + 'porca miseria', + 'porca puttana', + 'porca', + 'porco dio', + 'porco due', + 'porco zio', + 'potta', + 'puppami', + 'puttana', + 'quaglia', + 'recchione', + 'regina', + 'ricchione', + 'rincoglionire', + 'rizzarsi', + 'rompiballe', + 'rottinculo', + 'ruffiano', + 'sbattere', + 'sbattersi', + 'sborra', + 'sborrata', + 'sborrone', + 'sbrodolata', + 'scopare', + 'scopata', + 'scorreggiare', + 'sega', + 'segaiolo', + 'slinguare', + 'slinguata', + 'smandrappata', + 'soccia', + 'socmel', + 'sorca', + 'spagnola', + 'spompinare', + 'sticchio', + 'stronza', + 'stronzata', + 'stronzo', + 'succhiami', + 'sveltina', + 'sverginare', + 'tarzanello', + 'terrone', + 'testa di cazzo', + 'tette', + 'tirare', + 'topa', + 'troia', + 'troietta', + 'troiona', + 'troione', + 'trombare', + 'uccello', + 'vacca', + 'vaffanculo', + 'vangare', + 'venire', + 'zinne', + 'zio cantante', + 'zoccola', ]; diff --git a/src/dict/nl.php b/src/dict/nl.php index 1d3b6e1..3536111 100644 --- a/src/dict/nl.php +++ b/src/dict/nl.php @@ -32,5 +32,5 @@ return [ 'geitenneuker', 'pedo', 'randdebiel', - 'lul' + 'lul', ]; diff --git a/src/dict/sk.php b/src/dict/sk.php index 8a325ba..9bbb141 100644 --- a/src/dict/sk.php +++ b/src/dict/sk.php @@ -2,52 +2,52 @@ return [ - /** - * List of bad words without accent. - * - * Provided by @kotass - */ - - "kokot", - "kokoti", - "jebat", - "jebnuty", - "vyjebany", - "buzerant", - "pica", - "pice", - "hovno", - "picus", - "vyjebanec", - "kurva", - "skurvenec", - "jebal", - "kurvu", - "buzik", - "bukviciak", - "chuj", - "chumaj", - "curak", - "debil", - "dement", - "jebacka", - "jeblina", - "jebo", - "popici", - "ojeb", - "ojebavat", - "picovat", - "rit", - "skokoteny", - "skurvit", - "trtko", - "ujeb", - "ujebat", - "jeba", - "zmrd", - "zjebat", - "zajebany", - "zapiceny", - "vytrtkany" + /* + * List of bad words without accent. + * + * Provided by @kotass + */ -]; \ No newline at end of file + 'kokot', + 'kokoti', + 'jebat', + 'jebnuty', + 'vyjebany', + 'buzerant', + 'pica', + 'pice', + 'hovno', + 'picus', + 'vyjebanec', + 'kurva', + 'skurvenec', + 'jebal', + 'kurvu', + 'buzik', + 'bukviciak', + 'chuj', + 'chumaj', + 'curak', + 'debil', + 'dement', + 'jebacka', + 'jeblina', + 'jebo', + 'popici', + 'ojeb', + 'ojebavat', + 'picovat', + 'rit', + 'skokoteny', + 'skurvit', + 'trtko', + 'ujeb', + 'ujebat', + 'jeba', + 'zmrd', + 'zjebat', + 'zajebany', + 'zapiceny', + 'vytrtkany', + +]; diff --git a/src/dict/zh-tw.php b/src/dict/zh-tw.php index cad3c14..fb650de 100644 --- a/src/dict/zh-tw.php +++ b/src/dict/zh-tw.php @@ -83,5 +83,5 @@ return [ '顏射', '肛交', '潮吹', - '軟屌' + '軟屌', ]; diff --git a/src/lang/en/validation.php b/src/lang/en/validation.php index ef453d5..1103f2e 100644 --- a/src/lang/en/validation.php +++ b/src/lang/en/validation.php @@ -1,5 +1,5 @@ 'The :attribute contains vulgar content' + 'profane' => 'The :attribute contains vulgar content', ]; diff --git a/src/lang/es/validation.php b/src/lang/es/validation.php index f8592ed..53f3064 100644 --- a/src/lang/es/validation.php +++ b/src/lang/es/validation.php @@ -1,5 +1,5 @@ 'El :attribute contiene palabras vulgares' + 'profane' => 'El :attribute contiene palabras vulgares', ]; diff --git a/src/lang/nl/validation.php b/src/lang/nl/validation.php index 90379e3..5a45d8d 100644 --- a/src/lang/nl/validation.php +++ b/src/lang/nl/validation.php @@ -1,5 +1,5 @@ 'Het :attribute veld bevat vulgaire inhoud' -]; \ No newline at end of file + 'profane' => 'Het :attribute veld bevat vulgaire inhoud', +]; diff --git a/src/lang/pt-br/validation.php b/src/lang/pt-br/validation.php index adbbefa..c357db2 100644 --- a/src/lang/pt-br/validation.php +++ b/src/lang/pt-br/validation.php @@ -1,5 +1,5 @@ 'O campo :attribute contém palavras vulgares' + 'profane' => 'O campo :attribute contém palavras vulgares', ]; diff --git a/src/lang/sk/validation.php b/src/lang/sk/validation.php index ed35b0e..0e93e5b 100644 --- a/src/lang/sk/validation.php +++ b/src/lang/sk/validation.php @@ -1,5 +1,5 @@ ':attribute obsahuje vulgárny obsah' + 'profane' => ':attribute obsahuje vulgárny obsah', ]; diff --git a/src/lang/zh-tw/validation.php b/src/lang/zh-tw/validation.php index d913aa4..47b195d 100644 --- a/src/lang/zh-tw/validation.php +++ b/src/lang/zh-tw/validation.php @@ -1,5 +1,5 @@ ':attribute欄位內容包含粗俗用詞,請您修正:)' + 'profane' => ':attribute欄位內容包含粗俗用詞,請您修正:)', ]; diff --git a/tests/DictionaryTest.php b/tests/DictionaryTest.php index 3285ef2..79abbcd 100644 --- a/tests/DictionaryTest.php +++ b/tests/DictionaryTest.php @@ -3,7 +3,6 @@ namespace LaravelProfaneTests; use LaravelProfane\Dictionary; -use LaravelProfaneTests\TestCase; class DictionaryTest extends TestCase { @@ -29,7 +28,7 @@ class DictionaryTest extends TestCase { $dictionary = new Dictionary([ 'es', - 'gr' + 'gr', ]); $expected = array_merge( @@ -56,4 +55,4 @@ class DictionaryTest extends TestCase $this->assertEquals($dictionary->getDictionary(), $expected); } -} \ No newline at end of file +} diff --git a/tests/ProfaneValidatorTest.php b/tests/ProfaneValidatorTest.php index 16b7a95..8b0617e 100644 --- a/tests/ProfaneValidatorTest.php +++ b/tests/ProfaneValidatorTest.php @@ -2,8 +2,6 @@ namespace LaravelProfaneTests; -use LaravelProfane\ProfaneValidator; -use LaravelProfaneTests\TestCase; use LaravelProfaneTests\Support\ProfaneValidatorBuilder; class ProfaneValidatorTest extends TestCase @@ -19,7 +17,7 @@ class ProfaneValidatorTest extends TestCase { $builder = new ProfaneValidatorBuilder(); - $this->assertFalse($builder->validate(['description', 'fck you bitch. 幹!', ['es', 'en' , 'zh-tw']])); + $this->assertFalse($builder->validate(['description', 'fck you bitch. 幹!', ['es', 'en', 'zh-tw']])); } public function test_can_evaluate_profanity_of_a_word() @@ -73,7 +71,7 @@ class ProfaneValidatorTest extends TestCase { $builder = new ProfaneValidatorBuilder('sk'); - $word = "piča"; + $word = 'piča'; $this->assertTrue($builder->build()->isProfane($word)); } @@ -83,7 +81,7 @@ class ProfaneValidatorTest extends TestCase $builder = new ProfaneValidatorBuilder('es'); // in spanish coño =! cono - $word = "coño"; + $word = 'coño'; $this->assertTrue($builder->build()->isProfane($word)); } @@ -94,7 +92,7 @@ class ProfaneValidatorTest extends TestCase $builder = new ProfaneValidatorBuilder('gr'); - $word = "μαλάκας"; + $word = 'μαλάκας'; $this->assertTrue($builder->build()->isProfane($word)); } @@ -105,6 +103,6 @@ class ProfaneValidatorTest extends TestCase $builder = new ProfaneValidatorBuilder(); - $this->assertFalse($builder->validate(['description', 'εισαι πουτανα', ['en' , 'gr']])); + $this->assertFalse($builder->validate(['description', 'εισαι πουτανα', ['en', 'gr']])); } } diff --git a/tests/StrTest.php b/tests/StrTest.php index e64d919..963e350 100644 --- a/tests/StrTest.php +++ b/tests/StrTest.php @@ -2,7 +2,6 @@ namespace LaravelProfaneTests; -use LaravelProfaneTests\TestCase; use LaravelProfane\Str; class StrTest extends TestCase diff --git a/tests/Support/ProfaneValidatorBuilder.php b/tests/Support/ProfaneValidatorBuilder.php index 63ae36d..e9f50e7 100644 --- a/tests/Support/ProfaneValidatorBuilder.php +++ b/tests/Support/ProfaneValidatorBuilder.php @@ -2,19 +2,21 @@ namespace LaravelProfaneTests\Support; -use LaravelProfane\ProfaneValidator; use LaravelProfane\Dictionary; +use LaravelProfane\ProfaneValidator; class ProfaneValidatorBuilder { /** - * [$profaneValidator description] + * [$profaneValidator description]. + * * @var [type] */ protected $profaneValidator; /** - * [__construct description] + * [__construct description]. + * * @param [type] $dictionary [description] */ public function __construct($dictionary = null) @@ -23,9 +25,11 @@ class ProfaneValidatorBuilder } /** - * [validate description] - * @param array $parameters [description] - * @return [type] [description] + * [validate description]. + * + * @param array $parameters [description] + * + * @return [type] [description] */ public function validate(array $parameters) { @@ -35,7 +39,8 @@ class ProfaneValidatorBuilder } /** - * [build description] + * [build description]. + * * @return LaravelProfane\ProfaneValidator */ public function build() diff --git a/tests/TestCase.php b/tests/TestCase.php index b72264d..efd3a87 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,13 +3,13 @@ namespace LaravelProfaneTests; use Illuminate\Support\Facades\Config; +use Mockery; use PHPUnit_Framework_TestCase; -use \Mockery; class TestCase extends PHPUnit_Framework_TestCase { /** - * [setUp description] + * [setUp description]. */ public function setUp() { @@ -18,7 +18,8 @@ class TestCase extends PHPUnit_Framework_TestCase } /** - * [tearDown description] + * [tearDown description]. + * * @return [type] [description] */ public function tearDown() @@ -28,7 +29,8 @@ class TestCase extends PHPUnit_Framework_TestCase } /** - * [mockConfigs description] + * [mockConfigs description]. + * * @return void */ protected function mockConfigs()