diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b9b4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor +/composer.lock +/clover.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..facecf3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,51 @@ +language: php + +sudo: false + +php: + - 7 + - 7.1 + - 7.2 + - nightly + +env: TMPDIR=/tmp USE_XDEBUG=false + +branches: + only: + master + +before_install: + - travis_retry composer self-update + +install: + - phpenv rehash + - travis_retry composer install --no-interaction --prefer-source + +stages: + - test + - phpstan analysis + - test with coverage + +before_script: + - if [[ "$USE_XDEBUG" == false ]]; then phpenv config-rm xdebug.ini || return 0; fi + +script: + - composer test + +jobs: + fast_finish: true + allow_failures: + - php: nightly + include: + - stage: phpstan analysis + php: 7.1 + env: TMPDIR=/tmp USE_XDEBUG=false + script: + - composer phpstan + - stage: test with coverage + php: 7.1 + env: TMPDIR=/tmp USE_XDEBUG=true + script: + - composer test-with-coverage + after_success: + - bash <(curl -s https://codecov.io/bash) -f ./clover.xml diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..6eab5aa --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2005-2015, Zend Technologies USA, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Zend Technologies USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..39cb926 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +Zend Framework 1 - Translate +============================ +[![Build Status](https://travis-ci.org/diablomedia/zf1-translate.svg?branch=master)](https://travis-ci.org/diablomedia/zf1-translate) +[![codecov](https://codecov.io/gh/diablomedia/zf1-translate/branch/master/graph/badge.svg)](https://codecov.io/gh/diablomedia/zf1-translate) +[![Latest Stable Version](https://poser.pugx.org/diablomedia/zendframework1-translate/v/stable)](https://packagist.org/packages/diablomedia/zendframework1-translate) +[![Total Downloads](https://poser.pugx.org/diablomedia/zendframework1-translate/downloads)](https://packagist.org/packages/diablomedia/zendframework1-translate) +[![License](https://poser.pugx.org/diablomedia/zendframework1-translate/license)](https://packagist.org/packages/diablomedia/zendframework1-translate) + +This is just the Zend_Translate component extracted from our fork of the Zend Framework 1 repo (https://github.com/diablomedia/zf1). diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f0efc0b --- /dev/null +++ b/composer.json @@ -0,0 +1,47 @@ +{ + "name": "diablomedia/zendframework1-translate", + "description": "Zend Framework 1 Translate component", + "type": "library", + "keywords": [ + "framework", + "zf1" + ], + "homepage": "http://framework.zend.com/", + "license": "BSD-3-Clause", + "minimum-stability": "dev", + "prefer-stable": true, + "require": { + "php": ">=7.0.0", + "diablomedia/zendframework1-exception": "^1.0.0", + "diablomedia/zendframework1-config": "^1.0.0", + "diablomedia/zendframework1-loader": "^1.0.0", + "diablomedia/zendframework1-cache": "dev-master", + "diablomedia/zendframework1-locale": "dev-master", + "diablomedia/zendframework1-log": "dev-master" + }, + "autoload": { + "psr-0": { + "Zend_": "src/" + } + }, + "autoload-dev": { + "psr-0": { + "Zend_": "tests/" + } + }, + "require-dev": { + "phpunit/phpunit": "^6.0", + "phpstan/phpstan": "^0.9.2" + }, + "include-path": [ + "src/" + ], + "archive": { + "exclude": ["/tests"] + }, + "scripts": { + "test": "phpunit ./tests", + "test-with-coverage": "phpunit --coverage-clover=clover.xml ./tests", + "phpstan": "phpstan analyze -l7 -c phpstan.neon --no-progress ./src ./tests --ansi" + } +} diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..096cae4 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,2 @@ +parameters: + ignoreErrors: diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..078072b --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,14 @@ + + + + ./src + + + diff --git a/tests/Zend/Translate/Adapter/_files/zend_cache---internal-metadatas---testid b/tests/Zend/Translate/Adapter/_files/zend_cache---internal-metadatas---testid new file mode 100644 index 0000000..4ea59d3 --- /dev/null +++ b/tests/Zend/Translate/Adapter/_files/zend_cache---internal-metadatas---testid @@ -0,0 +1 @@ +a:4:{s:4:"hash";i:2616152583;s:5:"mtime";i:1521741383;s:6:"expire";i:1521741503;s:4:"tags";a:0:{}} \ No newline at end of file diff --git a/tests/Zend/Translate/Adapter/_files/zend_cache---testid b/tests/Zend/Translate/Adapter/_files/zend_cache---testid new file mode 100644 index 0000000..93c242c --- /dev/null +++ b/tests/Zend/Translate/Adapter/_files/zend_cache---testid @@ -0,0 +1 @@ +s:8:"testdata"; \ No newline at end of file diff --git a/tests/Zend/TranslateTest.php b/tests/Zend/TranslateTest.php index 6cbd1da..37b4c18 100644 --- a/tests/Zend/TranslateTest.php +++ b/tests/Zend/TranslateTest.php @@ -261,7 +261,6 @@ public function testZF3679() { require_once 'Zend/Locale.php'; $locale = new Zend_Locale('de_AT'); - require_once 'Zend/Registry.php'; Zend_Registry::set('Zend_Locale', $locale); $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'message1'), 'de_AT');