/**
  *
  */
 public function testPathDoesNotExist()
 {
     $messageBag = new MessageBag();
     $manager = new Localization($messageBag);
     $this->setExpectedException('\\Potsky\\LaravelLocalizationHelpers\\Factory\\Exception');
     $manager->fixCodeStyle(self::LANG_DIR_PATH . '/file_does_not_exist', array('align_double_arrow', 'short_array_syntax'));
 }
 /**
  * Error when days is negative
  */
 public function testErrorDaysNegative()
 {
     /** @noinspection PhpVoidFunctionResultUsedInspection */
     $return = Artisan::call('localization:clear', array('--days' => -3));
     $this->assertEquals(1, $return);
     $manager = new Localization(new MessageBag());
     $this->assertFalse($manager->deleteBackupFiles('', -3, true));
 }
 /**
  * https://github.com/potsky/laravel-localization-helpers/issues/20
  */
 public function testDotInPath()
 {
     $messageBag = new MessageBag();
     $manager = new Localization($messageBag);
     $now = '20160129_202938';
     $this->assertSame('/nia/nio/message.' . $now . '.php', $manager->getBackupPath('/nia/nio/message.php', $now));
     $this->assertSame('/var/www/kd/domain.com/message.' . $now . '.php', $manager->getBackupPath('/var/www/kd/domain.com/message.php', $now));
     $this->assertSame('/var/www/kd/domain.com/message.' . $now . '.txt', $manager->getBackupPath('/var/www/kd/domain.com/message.txt', $now, 'txt'));
 }
 /**
  *
  */
 public function testSearchForRegexLemma()
 {
     /** @noinspection PhpVoidFunctionResultUsedInspection */
     $return = Artisan::call('localization:find', array('lemma' => 'message\\.lemma.*', '--verbose' => true, '--short' => true, '--regex' => true));
     $this->assertEquals(1, $return);
     $this->assertContains('The argument is not a valid regular expression:', Artisan::output());
     /** @noinspection PhpVoidFunctionResultUsedInspection */
     $return = Artisan::call('localization:find', array('lemma' => '@message\\.lemma.*@', '--verbose' => true, '--short' => true, '--regex' => true));
     $this->assertEquals(0, $return);
     $this->assertContains('has been found in', Artisan::output());
     $messageBag = new MessageBag();
     $manager = new Localization($messageBag);
     $trans_methods = array('trans' => array('@trans\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@trans\\(\\s*(".*")\\s*(,.*)*\\)@U'), 'Lang::Get' => array('@Lang::Get\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@Lang::Get\\(\\s*(".*")\\s*(,.*)*\\)@U', '@Lang::get\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@Lang::get\\(\\s*(".*")\\s*(,.*)*\\)@U'), 'trans_choice' => array('@trans_choice\\(\\s*(\'.*\')\\s*,.*\\)@U', '@trans_choice\\(\\s*(".*")\\s*,.*\\)@U'), 'Lang::choice' => array('@Lang::choice\\(\\s*(\'.*\')\\s*,.*\\)@U', '@Lang::choice\\(\\s*(".*")\\s*,.*\\)@U'), '@lang' => array('@\\@lang\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@\\@lang\\(\\s*(".*")\\s*(,.*)*\\)@U'), '@choice' => array('@\\@choice\\(\\s*(\'.*\')\\s*,.*\\)@U', '@\\@choice\\(\\s*(".*")\\s*,.*\\)@U'));
     $return = $manager->findLemma('not a valid regex', $manager->getPath(self::MOCK_DIR_PATH_GLOBAL), $trans_methods, true, true);
     $messages = $messageBag->getMessages();
     $this->assertFalse($return);
     $this->assertContains('The argument is not a valid regular expression:', $messages[0][1]);
 }
 /**
  *
  */
 public function testNoTranslation()
 {
     $manager = new Localization(new MessageBag());
     $this->assertEquals('AAA', $manager->translate('AAA', 'zz'));
 }