Skip to content

Commit e6ecf25

Browse files
authored
Merge pull request #37 from moufmouf/graphqlite_bundle_test_in_travis
Adding GraphQLite bundle tests in Travis.
2 parents b3fad94 + 4e74262 commit e6ecf25

7 files changed

+87
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ website/build/
1515
website/yarn.lock
1616
website/node_modules
1717
website/i18n/*
18+
19+
/tests/dependencies/copy/
20+
/tests/dependencies/graphqlite-bundle/
21+
/tests/dependencies/graphqlite-laravel/
22+
/tests/dependencies/graphqlite-universal-service-provider/

.travis.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,48 @@ jobs:
3737
- *composerupdate
3838
script:
3939
- *phpunit
40+
# Test bundle
41+
- stage: test_dependencies
42+
php: 7.3
43+
env: PREFER_LOWEST=""
44+
before_script:
45+
- mkdir -p tests/dependencies
46+
- rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
47+
- cd tests/dependencies
48+
- git clone https://github.com/thecodingmachine/graphqlite-bundle.git
49+
- php ./makeComposerLocal.php graphqlite-bundle/composer.json
50+
- cd graphqlite-bundle
51+
- composer install
52+
script:
53+
- vendor/bin/phpunit
54+
# Test graphqlite-universal-service-provider
55+
- stage: test_dependencies
56+
php: 7.3
57+
env: PREFER_LOWEST=""
58+
before_script:
59+
- mkdir -p tests/dependencies
60+
- rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
61+
- cd tests/dependencies
62+
- git clone https://github.com/thecodingmachine/graphqlite-universal-service-provider.git
63+
- php ./makeComposerLocal.php graphqlite-universal-service-provider/composer.json
64+
- cd graphqlite-universal-service-provider
65+
- composer install
66+
script:
67+
- vendor/bin/phpunit
68+
# Test graphqlite-laravel
69+
- stage: test_dependencies
70+
php: 7.3
71+
env: PREFER_LOWEST=""
72+
before_script:
73+
- mkdir -p tests/dependencies
74+
- rsync -av . tests/dependencies/copy/ --exclude tests --exclude vendor
75+
- cd tests/dependencies
76+
- git clone https://github.com/thecodingmachine/graphqlite-laravel.git
77+
- php ./makeComposerLocal.php graphqlite-laravel/composer.json
78+
- cd graphqlite-laravel
79+
- composer install
80+
script:
81+
- vendor/bin/phpunit
4082
- stage: doc
4183
if: branch = master AND type = push
4284
name: "Doc generation"
@@ -49,3 +91,6 @@ jobs:
4991
- git config --global user.email "${GH_EMAIL}"
5092
- echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
5193
- cd website && yarn install && GIT_USER="${GH_NAME}" yarn run publish-gh-pages
94+
matrix:
95+
allow_failures:
96+
- stage: test_dependencies

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<testsuites>
1515
<testsuite name="GraphQLite Test Suite">
1616
<directory>./tests/</directory>
17+
<exclude>./tests/dependencies/</exclude>
1718
</testsuite>
1819
</testsuites>
1920

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
4+
namespace TheCodingMachine\GraphQLite\Fixtures;
5+
6+
use TheCodingMachine\GraphQLite\Annotations\Query;
7+
8+
// An abstract class to test that the GlobControllerQueryProvider does not try anything with it.
9+
abstract class AbstractTestController
10+
{
11+
/**
12+
* @Query()
13+
*/
14+
public function test(): string
15+
{
16+
return 'foo';
17+
}
18+
}

tests/Fixtures/EmptyFile.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
// Used to check that the GlobControllerQueryProvider can manage empty classes

tests/GlobControllerQueryProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function has($id)
3434
}
3535
};
3636

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

3939
$queries = $globControllerQueryProvider->getQueries();
4040
$this->assertCount(6, $queries);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/env php
2+
<?php
3+
4+
$file = $argv[1];
5+
6+
$composer = json_decode(file_get_contents($file), true);
7+
8+
$composer['repositories'] = [
9+
[
10+
'type' => 'path',
11+
'url' => '../copy/'
12+
]
13+
];
14+
15+
file_put_contents($file, json_encode($composer));

0 commit comments

Comments
 (0)