Skip to content

Adding GraphQLite bundle tests in Travis. #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ website/build/
website/yarn.lock
website/node_modules
website/i18n/*

/tests/dependencies/copy/
/tests/dependencies/graphqlite-bundle/
/tests/dependencies/graphqlite-laravel/
/tests/dependencies/graphqlite-universal-service-provider/
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,48 @@ jobs:
- *composerupdate
script:
- *phpunit
# Test bundle
- stage: test_dependencies
php: 7.3
env: PREFER_LOWEST=""
before_script:
- mkdir -p tests/dependencies
- rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
- cd tests/dependencies
- git clone https://github.com/thecodingmachine/graphqlite-bundle.git
- php ./makeComposerLocal.php graphqlite-bundle/composer.json
- cd graphqlite-bundle
- composer install
script:
- vendor/bin/phpunit
# Test graphqlite-universal-service-provider
- stage: test_dependencies
php: 7.3
env: PREFER_LOWEST=""
before_script:
- mkdir -p tests/dependencies
- rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
- cd tests/dependencies
- git clone https://github.com/thecodingmachine/graphqlite-universal-service-provider.git
- php ./makeComposerLocal.php graphqlite-universal-service-provider/composer.json
- cd graphqlite-universal-service-provider
- composer install
script:
- vendor/bin/phpunit
# Test graphqlite-laravel
- stage: test_dependencies
php: 7.3
env: PREFER_LOWEST=""
before_script:
- mkdir -p tests/dependencies
- rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
- cd tests/dependencies
- git clone https://github.com/thecodingmachine/graphqlite-laravel.git
- php ./makeComposerLocal.php graphqlite-laravel/composer.json
- cd graphqlite-laravel
- composer install
script:
- vendor/bin/phpunit
- stage: doc
if: branch = master AND type = push
name: "Doc generation"
Expand All @@ -49,3 +91,6 @@ jobs:
- git config --global user.email "${GH_EMAIL}"
- echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
- cd website && yarn install && GIT_USER="${GH_NAME}" yarn run publish-gh-pages
matrix:
allow_failures:
- stage: test_dependencies
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<testsuites>
<testsuite name="GraphQLite Test Suite">
<directory>./tests/</directory>
<exclude>./tests/dependencies/</exclude>
</testsuite>
</testsuites>

Expand Down
18 changes: 18 additions & 0 deletions tests/Fixtures/AbstractTestController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php


namespace TheCodingMachine\GraphQLite\Fixtures;

use TheCodingMachine\GraphQLite\Annotations\Query;

// An abstract class to test that the GlobControllerQueryProvider does not try anything with it.
abstract class AbstractTestController
{
/**
* @Query()
*/
public function test(): string
{
return 'foo';
}
}
2 changes: 2 additions & 0 deletions tests/Fixtures/EmptyFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
// Used to check that the GlobControllerQueryProvider can manage empty classes
2 changes: 1 addition & 1 deletion tests/GlobControllerQueryProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function has($id)
}
};

$globControllerQueryProvider = new GlobControllerQueryProvider('TheCodingMachine\\GraphQLite', $this->getControllerQueryProviderFactory(), $this->getTypeMapper(), $container, $this->getLockFactory(), new NullCache());
$globControllerQueryProvider = new GlobControllerQueryProvider('TheCodingMachine\\GraphQLite\\Fixtures', $this->getControllerQueryProviderFactory(), $this->getTypeMapper(), $container, $this->getLockFactory(), new NullCache(), null, false);

$queries = $globControllerQueryProvider->getQueries();
$this->assertCount(6, $queries);
Expand Down
15 changes: 15 additions & 0 deletions tests/dependencies/makeComposerLocal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/env php
<?php

$file = $argv[1];

$composer = json_decode(file_get_contents($file), true);

$composer['repositories'] = [
[
'type' => 'path',
'url' => '../copy/'
]
];

file_put_contents($file, json_encode($composer));