From d50d9680ccc8134f9afb884c3dff36c294e957d4 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Mon, 2 Jan 2017 00:01:51 +0100 Subject: [PATCH 1/3] Added tests --- tests/Unit/Model/MessageTest.php | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/Unit/Model/MessageTest.php diff --git a/tests/Unit/Model/MessageTest.php b/tests/Unit/Model/MessageTest.php new file mode 100644 index 0000000..449ae9c --- /dev/null +++ b/tests/Unit/Model/MessageTest.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Translation\common\tests\Unit\Model; + +use Translation\Common\Model\Message; + +/** + * @author Tobias Nyholm + */ +class MessageTest extends \PHPUnit_Framework_TestCase +{ + public function testAccessors() + { + $message = new Message('key', 'domain', 'locale', 'translation'); + + $this->assertEquals('key', $message->getKey()); + $this->assertEquals('domain', $message->getDomain()); + $this->assertEquals('locale', $message->getLocale()); + $this->assertEquals('translation', $message->getTranslation()); + + $message->setKey('key_foo'); + $this->assertEquals('key_foo', $message->getKey()); + $message->setDomain('domain_foo'); + $this->assertEquals('domain_foo', $message->getDomain()); + $message->setLocale('locale_foo'); + $this->assertEquals('locale_foo', $message->getLocale()); + $message->setTranslation('trans_foo'); + $this->assertEquals('trans_foo', $message->getTranslation()); + } + + public function testMeta() + { + $message = new Message('', '', '', '', ['foo' => 'bar']); + + $this->assertEquals(['foo' => 'bar'], $message->getAllMeta()); + $this->assertEquals('bar', $message->getMeta('foo')); + + $message->addMeta('key', 'value'); + $this->assertEquals('value', $message->getMeta('key')); + + $message->setMeta(['new' => 'values']); + $this->assertNull($message->getMeta('key')); + $this->assertEquals('values', $message->getMeta('new')); + } +} From f939317206b3c3fe2d9f95951437f10a7b7b63bc Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Mon, 2 Jan 2017 00:03:32 +0100 Subject: [PATCH 2/3] Added readme --- Readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..2d26e9a --- /dev/null +++ b/Readme.md @@ -0,0 +1,19 @@ +# Common classes and interfaces + +[![Latest Version](https://img.shields.io/github/release/php-translation/common.svg?style=flat-square)](https://github.com/php-translation/common/releases) +[![Build Status](https://img.shields.io/travis/php-translation/common.svg?style=flat-square)](https://travis-ci.org/php-translation/common) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-translation/common.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-translation/common) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-translation/common.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-translation/common) +[![Total Downloads](https://img.shields.io/packagist/dt/php-translation/common.svg?style=flat-square)](https://packagist.org/packages/php-translation/common) + + +## Install + +``` bash +$ composer require php-translation/common +``` + +## Documentation + +Read the full documentation at [http://php-translation.readthedocs.io](http://php-translation.readthedocs.io/en/latest/). + From e50ff04b3daca746ab4ff868ff73aff349171149 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Mon, 2 Jan 2017 00:04:25 +0100 Subject: [PATCH 3/3] Do not tests patch branches --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 91530dd..8558c6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ cache: branches: except: - /^analysis-.*$/ + - /^patch-.*$/ php: - 5.4