diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7a9477d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,58 @@ +language: php +sudo: false +cache: + directories: + - $HOME/.composer/cache/files + - $HOME/symfony-bridge/.phpunit + +env: + global: + - PHPUNIT_FLAGS="-v" + - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" + +matrix: + fast_finish: true + include: + # Minimum supported dependencies with the latest and oldest PHP version + - php: 7.2 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors" + - php: 5.5 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors" + + # Test the latest stable release + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + env: COVERAGE=true PHPUNIT_FLAGS="-v --testsuite main --coverage-text --coverage-clover=build/coverage.xml" + + - php: 7.1 + env: DEPENDENCIES="dunglas/symfony-lock:^2" + - php: 7.1 + env: DEPENDENCIES="dunglas/symfony-lock:^3" + - php: 7.1 + env: DEPENDENCIES="dunglas/symfony-lock:^4" + + # Latest commit to master + - php: 7.2 + env: STABILITY="dev" + + allow_failures: + # Dev-master is allowed to fail. + - env: STABILITY="dev" + +before_install: + - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi + - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; + - if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi; + +install: + # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 + - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi + - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction + - ./vendor/bin/simple-phpunit install + +script: + - composer validate --strict --no-check-lock + - ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS diff --git a/Tests/BundleInitializationTest.php b/Tests/BundleInitializationTest.php new file mode 100644 index 0000000..3f80cee --- /dev/null +++ b/Tests/BundleInitializationTest.php @@ -0,0 +1,43 @@ +addCompilerPass(new PublicServicePass('|happyr.*|')); + } + + protected function getBundleClass() + { + return HappyrLinkedInBundle::class; + } + + public function testInitBundle() + { + $kernel = $this->createKernel(); + $kernel->addConfigFile(__DIR__.'/config.yml'); + $kernel->addBundle(HttplugBundle::class); + + + // Boot the kernel. + $this->bootKernel(); + + // Get the container + $container = $this->getContainer(); + + // Test if you services exists + $this->assertTrue($container->has('happyr.linkedin')); + $service = $container->get('happyr.linkedin'); + $this->assertInstanceOf(LinkedIn::class, $service); + } +} \ No newline at end of file diff --git a/Tests/config.yml b/Tests/config.yml new file mode 100644 index 0000000..6018ac8 --- /dev/null +++ b/Tests/config.yml @@ -0,0 +1,3 @@ +happyr_linkedin: + app_id: foo + app_secret: bar \ No newline at end of file diff --git a/composer.json b/composer.json index 98052ec..8d32827 100644 --- a/composer.json +++ b/composer.json @@ -13,14 +13,28 @@ ], "require": { "php": "^5.5 || ^7.0", - "symfony/symfony":"^2.3 || ^3.0", "happyr/linkedin-api-client": "^1.0", - "php-http/httplug-bundle": "^1.0" + "symfony/dependency-injection": "^2.3 || ^3.0 || ^4.0", + "symfony/http-kernel": "^2.3 || ^3.0 || ^4.0" }, + "require-dev": { + "guzzlehttp/psr7": "^1.4", + "nyholm/symfony-bundle-test": "^1.3.1", + "php-http/curl-client": "^1.7", + "php-http/httplug-bundle": "^1.8", + "php-http/message": "^1.6", + "symfony/phpunit-bridge": "^3.4 || ^4.0" + }, + "suggest": { + "php-http/httplug-bundle": "For easier configure your HTTP clients" + }, + "autoload": { "psr-4": { "Happyr\\LinkedInBundle\\": "" } + }, + "config": { + "sort-packages": true } } - diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..6bb391c --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + + ./Tests + + + + + + . + + ./Resources + ./Tests + ./vendor + + + +