Skip to content

Commit

Permalink
Merge pull request #3 from MammutAlex/analysis-zE2nlO
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
MammutAlex authored Mar 14, 2017
2 parents 385616f + 789b9c9 commit 3654fc7
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
3 changes: 0 additions & 3 deletions src/Polyglot.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function translation($name, $locale = null)
return $this->transLaravelLocale($name);
}


/**
* Trans data width laravel locale.
*
Expand All @@ -46,7 +45,6 @@ private function transLaravelLocale($name)
return $this->templateMultiLangColumn($name, App::getLocale());
}


/**
* Trans data width customer locale.
*
Expand All @@ -64,7 +62,6 @@ private function templateMultiLangColumn($name, $locale)
return $this->{$this->transformTemplate($name, $locale)};
}


public function transformTemplate($name, $locale)
{
return $name.'_'.$locale;
Expand Down
8 changes: 1 addition & 7 deletions tests/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,34 @@

class Post extends Model
{

use Polyglot;

protected $table = 'posts';

protected $defaultLang = 'en';


public function transformTemplate($name, $locale)
{
return $locale.'_lang_'.$name;
}


public function title()
{
return $this->translation('title');
}


public function text()
{
return $this->translation('text');
}


public function textRu()
{
return $this->translation('text', 'ru');
}


public function textYouLang($lang)
{
return $this->translation('text', $lang);
}
}
}
8 changes: 0 additions & 8 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

abstract class TestCase extends BaseTestCase
{

use CreatesApplication;


public function setUp()
{
parent::setUp();
Expand All @@ -26,13 +24,11 @@ public function setUp()
$this->migrate();
}


public function getTempDirectory()
{
return __DIR__.'/temp';
}


public function migrate()
{
$this->createArticles();
Expand All @@ -41,7 +37,6 @@ public function migrate()
$this->seedPosts();
}


private function createArticles()
{
Schema::create('articles', function ($table) {
Expand All @@ -56,7 +51,6 @@ private function createArticles()
});
}


private function createPosts()
{
Schema::create('posts', function ($table) {
Expand All @@ -71,7 +65,6 @@ private function createPosts()
});
}


private function seedArticles()
{
DB::table('articles')->insert([
Expand All @@ -84,7 +77,6 @@ private function seedArticles()
]);
}


private function seedPosts()
{
DB::table('posts')->insert([
Expand Down
4 changes: 0 additions & 4 deletions tests/TransPostsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class TransPostsTest extends TestCase
{

public function testTitleLocale()
{
$post = Post::find(1);
Expand All @@ -22,7 +21,6 @@ public function testTitleLocale()
$this->assertTrue($post->title() == 'Hello Word');
}


public function testTextLocale()
{
$post = Post::find(1);
Expand All @@ -37,7 +35,6 @@ public function testTextLocale()
$this->assertTrue($post->text() == 'Текст про привіт світ');
}


public function testTransToRuInLangEn()
{
$post = Post::find(1);
Expand All @@ -46,7 +43,6 @@ public function testTransToRuInLangEn()
$this->assertTrue($post->textRu() == 'Текст о привет мир');
}


public function testTransToYouLangInLangEn()
{
$post = Post::find(1);
Expand Down

0 comments on commit 3654fc7

Please sign in to comment.