Skip to content
This repository has been archived by the owner on Jan 27, 2020. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Nov 21, 2015
0 parents commit 916ac3f
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor
composer.lock
.idea/
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) 2015 Mohamed Said <theMohamedSaid@gmail.com>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
Empty file added README.md
Empty file.
29 changes: 29 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "themsaid/Multilingual",
"description": "Easy multilingual laravel models",
"keywords": ["laravel", "multilingual", "translation"],
"homepage": "https://github.com/themsaid/laravel-multilingual",
"license": "MIT",
"authors": [
{
"name": "Mohamed Said",
"email": "theMohamedSaid@gmail.com"
}
],
"require": {
"illuminate/support": "~5.1",
"php" : ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit" : "4.*",
"orchestra/testbench": "~3.0"
},
"autoload": {
"psr-4": {
"Themsaid\\Multilingual\\": "src"
},
"classmap": [
"tests"
]
}
}
17 changes: 17 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
28 changes: 28 additions & 0 deletions src/MultilingualServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Themsaid\Multilingual;

use Illuminate\Support\ServiceProvider;

class MultilingualServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{

}

/**
* Register any package services.
*
* @return void
*/
public function register()
{
//
}
}
88 changes: 88 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class TestCase extends Orchestra\Testbench\TestCase {

protected $DBName = 'laravel_multilingual_test';
protected $DBUsername = 'homestead';
protected $DBPassword = 'secret';

/**
* Setup the test environment.
*
* @return void
*/
public function setUp()
{
parent::setUp();

$this->prepareDatabase();
}

public function test_database_setup()
{
$this->assertTrue(Schema::hasTable('planets'));
}

/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('database.default', 'mysql');
$app['config']->set('database.connections.mysql', [
'driver' => 'mysql',
'host' => 'localhost',
'database' => $this->DBName,
'username' => $this->DBUsername,
'password' => $this->DBPassword,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
]);
}

/**
* Loading package service provider
*
* @param \Illuminate\Foundation\Application $app
* @return array
*/
protected function getPackageProviders($app)
{
return ['Themsaid\Multilingual\MultilingualServiceProvider'];
}

/**
* Get package aliases.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageAliases($app)
{
return [
'Schema' => 'Illuminate\Database\Schema\Blueprint'
];
}

public function prepareDatabase()
{
Schema::dropIfExists('planets');

Schema::create('planets', function (Blueprint $table)
{
$table->increments('id');
$table->string('name');
});

}
}
15 changes: 15 additions & 0 deletions tests/TranslationsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExampleTest extends TestCase {

/**
*
* @return void
*/
public function testBasicExample()
{
$this->assertEquals(1, 1);
}
}

0 comments on commit 916ac3f

Please sign in to comment.