-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some tests and sf4 support (#12)
* Added some tests and sf4 support * Do not use -v flag * Adding phpunit.xml * Minors * Make sure test pass * Added HTTP bundle to suggest
- Loading branch information
Showing
5 changed files
with
151 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Happyr\LinkedInBundle\Tests; | ||
|
||
use Happyr\LinkedIn\LinkedIn; | ||
use Happyr\LinkedInBundle\HappyrLinkedInBundle; | ||
use Http\HttplugBundle\HttplugBundle; | ||
use Nyholm\BundleTest\BaseBundleTestCase; | ||
use Nyholm\BundleTest\CompilerPass\PublicServicePass; | ||
|
||
class BundleInitializationTest extends BaseBundleTestCase | ||
{ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
happyr_linkedin: | ||
app_id: foo | ||
app_secret: bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<testsuites> | ||
<testsuite name="main"> | ||
<directory>./Tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>.</directory> | ||
<exclude> | ||
<directory>./Resources</directory> | ||
<directory>./Tests</directory> | ||
<directory>./vendor</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |