From 651196539921e101af16de2243897d8f7a533602 Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Sun, 23 Oct 2016 07:51:09 +0200 Subject: [PATCH 1/2] Cleanup phing build --- .gitignore | 3 +++ .gitmodules | 6 ------ Fixtures/symfony | 1 - Fixtures/thrift | 1 - Tests/bootstrap.php | 18 +----------------- composer.json | 3 +++ phpunit.xml.dist | 22 +++++++++------------- 7 files changed, 16 insertions(+), 38 deletions(-) delete mode 100644 .gitmodules delete mode 160000 Fixtures/symfony delete mode 160000 Fixtures/thrift diff --git a/.gitignore b/.gitignore index 084fb51..0302596 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ /Thrift/ext/thrift_protocol/.libs/ /vendor +/build +/Tests/thrift composer.phar composer.lock +.gitignore diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 6b5116f..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "Fixtures/symfony"] - path = Fixtures/symfony - url = git://github.com/symfony/symfony.git -[submodule "Fixtures/thrift"] - path = Fixtures/thrift - url = git@github.com:apache/thrift.git diff --git a/Fixtures/symfony b/Fixtures/symfony deleted file mode 160000 index 0999ea7..0000000 --- a/Fixtures/symfony +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0999ea74b7f5ab8019866aa2994ca35903010b2b diff --git a/Fixtures/thrift b/Fixtures/thrift deleted file mode 160000 index 591e20f..0000000 --- a/Fixtures/thrift +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 591e20f9636c37527a70dc03598218c3468a0eff diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index b1d284a..b27d9e5 100644 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -1,19 +1,3 @@ addPrefix('Symfony', $_SERVER['SYMFONY']); -$loader->addPrefix('Thrift', $_SERVER['THRIFT']); -$loader->register(); - -spl_autoload_register(function($class) -{ - if (0 === strpos($class, 'Overblog\\ThriftBundle\\')) { - $path = implode('/', array_slice(explode('\\', $class), 2)).'.php'; - require_once __DIR__.'/../'.$path; - return true; - } -}); \ No newline at end of file +$loader = require __DIR__.'/../vendor/autoload.php'; diff --git a/composer.json b/composer.json index 7bea010..fc8c587 100755 --- a/composer.json +++ b/composer.json @@ -20,5 +20,8 @@ "exclude-from-classmap": [ "/Tests/" ] + }, + "require-dev": { + "phing/phing": "2.*" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index be6ea0f..f6041e3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,18 +1,14 @@ - - - - + backupStaticAttributes="false" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false" + syntaxCheck="false" + bootstrap="./Tests/bootstrap.php"> ./Tests From 50695571d26683dd8ede3ccd88464c60aec31376 Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Sun, 23 Oct 2016 08:20:28 +0200 Subject: [PATCH 2/2] Add travis --- .gitignore | 1 - .travis.yml | 55 +++++++++++++++++++++++++++++++ README.md | 2 ++ Tests/Client/ThriftClientTest.php | 8 +---- Tests/ThriftBundleTestCase.php | 6 ++-- composer.json | 1 - phpunit.xml.dist | 2 +- 7 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index 0302596..9a86f79 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -/Thrift/ext/thrift_protocol/.libs/ /vendor /build /Tests/thrift diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9b54d7c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,55 @@ +language: php + +sudo: required + +dist: xenial + +php: + - nightly + - hhvm + +branches: + only: + - master + - /^\d+\.\d+$/ +env: + global: + - THRIFT_VERSION=0.9.2 + +matrix: + fast_finish: true + include: + - php: 5.4 + env: SYMFONY_VERSION=2.3.* + - php: 5.5 + env: SYMFONY_VERSION=2.7.* + - php: 5.6 + env: SYMFONY_VERSION=3.0.* + - php: 7.0 + env: SYMFONY_VERSION=3.0.* + - php: 7.1 + env: SYMFONY_VERSION=3.1.* + +allow_failures: + - php: nightly + +cache: + directories: + - $HOME/.composer/cache + +before_install: + - travis_retry sudo apt-get update + - travis_retry sudo apt-get install automake bison flex g++ git libboost1.55-all-dev libevent-dev libssl-dev libtool make pkg-config openjdk-7-jdk php5-dev php5-cli phpunit + - cd /tmp && (curl http://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz | tar zx) && cd thrift-${THRIFT_VERSION}/ && ./configure --without-qt4 --without-c_glib --without-csharp --without-java --without-erlang --without-python --without-perl --with-php --with-php_extension --without-ruby --without-haskell --without-go --without-d --without-cpp && make && sudo make install && cd ${TRAVIS_BUILD_DIR} + - if [[ "$TRAVIS_PHP_VERSION" != "5.6" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini || true; fi + - composer selfupdate + - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; + - composer require "apache/thrift:${THRIFT_VERSION}" + +install: + - composer update --prefer-dist --no-interaction + +script: if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then phpunit -d xdebug.max_nesting_level=1000 --debug --coverage-clover=coverage.clover; else phpunit --debug; fi + +#after_script: +# - if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/README.md b/README.md index bb7a606..11ffe92 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # OverBlog Thrift Bundle # +[![Build Status](https://travis-ci.org/overblog/ThriftBundle.svg?branch=master)](https://travis-ci.org/overblog/ThriftBundle) + What is this repository ? ---------------------- diff --git a/Tests/Client/ThriftClientTest.php b/Tests/Client/ThriftClientTest.php index bd23e7f..67b4b21 100755 --- a/Tests/Client/ThriftClientTest.php +++ b/Tests/Client/ThriftClientTest.php @@ -216,12 +216,6 @@ public function testSocketClient() } } - - protected function onNotSuccessfulTest($e) - { - parent::onNotSuccessfulTest($e); - } - public function testMultiSocketClient() { $thriftClient = new ThriftClient($this->factory, array( @@ -260,4 +254,4 @@ public function testMultiSocketClient() $this->assertInstanceOf('Thrift\Exception\TException', $e); } } -} \ No newline at end of file +} diff --git a/Tests/ThriftBundleTestCase.php b/Tests/ThriftBundleTestCase.php index 4ead52c..ae52ea1 100755 --- a/Tests/ThriftBundleTestCase.php +++ b/Tests/ThriftBundleTestCase.php @@ -24,7 +24,9 @@ protected function compile() //Build cache $this->compiler = new ThriftCompiler(); $this->compiler->setModelPath($this->modelPath); - $this->compiler->compile($this->definitionPath, true); + if (!$this->compiler->compile($this->definitionPath, true)) { + throw new \RuntimeException(sprintf('Compile failed: "%s".', json_encode($this->compiler->getLastOutput()))); + } // Init Loader $l = new MapClassLoader(ClassMapGenerator::createMap($this->modelPath)); @@ -42,4 +44,4 @@ protected function onNotSuccessfulTest($e) parent::onNotSuccessfulTest($e); } -} \ No newline at end of file +} diff --git a/composer.json b/composer.json index fc8c587..9b1e51a 100755 --- a/composer.json +++ b/composer.json @@ -22,6 +22,5 @@ ] }, "require-dev": { - "phing/phing": "2.*" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f6041e3..9f449d6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -19,7 +19,7 @@ ./ ./Tests - ./Fixtures + ./vendor