Skip to content

Commit

Permalink
Merge branch '2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgaal committed Feb 28, 2019
2 parents fa9c66e + 1aa5dbe commit 519ee7b
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
language: php

branches:
only:
- master
- develop

php:
- 7.1
- 7.2
- 7.3

env:
- TESTBENCH_VERSION="3.6.*" # Laravel 5.6
- TESTBENCH_VERSION="3.7.*" # Laravel 5.7
- TESTBENCH_VERSION="3.8.*" # Laravel 5.8

install:
- travis_retry composer self-update
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ An on-the-fly GraphQL Schema generator from Eloquent models for Laravel.

## Version Compatibility

| Laravel | Bakery | Support |
| :------ | :----- | :------ |
| 5.4.x | 1.0.x | |
| 5.5.x | 1.0.x | |
| 5.6.x | 2.0.x ||
| 5.7.x | 2.1.x ||
| Laravel | Bakery | Support |
| :------------------ | :----- | :------ |
| 5.4.x, 5.5.x | 1.0.x | |
| 5.6.x, 5.7.x, 5.8.x | 2.1.x ||

## Installation

Expand All @@ -35,7 +33,7 @@ or require in `composer.json`:
```json
{
"require": {
"scrnhq/laravel-bakery": "^2.1"
"scrnhq/laravel-bakery": "^2.2"
}
}
```
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"php": ">=7.1.0",
"illuminate/support": "5.6.*|5.7.*",
"illuminate/support": "5.6.*|5.7.*|5.8.*",
"webonyx/graphql-php": "^0.12.0",
"ext-json": "*"
},
Expand All @@ -27,6 +27,8 @@
"phpunit/phpunit": "^7.1",
"mockery/mockery": "^1.2"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Bakery\\": "src"
Expand Down
4 changes: 3 additions & 1 deletion src/Traits/JoinsRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public function joinRelation(Builder $query, Relations\Relation $relation, strin
$related = $relation->getRelated();

if ($relation instanceof Relations\BelongsTo) {
$query->join($related->getTable(), $relation->getQualifiedOwnerKeyName(), '=', $relation->getQualifiedForeignKey(), $type, $where);
$foreignKeyName = method_exists($relation, 'getQualifiedForeignKey')
? $relation->getQualifiedForeignKey() : $relation->getQualifiedForeignKeyName();
$query->join($related->getTable(), $relation->getQualifiedOwnerKeyName(), '=', $foreignKeyName, $type, $where);
} elseif ($relation instanceof Relations\BelongsToMany) {
$foreignPivotKeyName = method_exists($relation, 'getQualifiedForeignPivotKeyName')
? $relation->getQualifiedForeignPivotKeyName() : $relation->getQualifiedForeignKeyName();
Expand Down
16 changes: 8 additions & 8 deletions tests/Feature/CollectionQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,14 @@ public function it_can_order_by_combination_of_nested_relations()
/** @test */
public function it_can_order_by_relations_and_have_correct_pagination_count()
{
$john = factory(User::class)->create(['email' => '[email protected]']);
$jane = factory(User::class)->create(['email' => '[email protected]']);
$joe = factory(User::class)->create(['email' => '[email protected]']);
$john = factory(Models\User::class)->create(['email' => '[email protected]']);
$jane = factory(Models\User::class)->create(['email' => '[email protected]']);
$joe = factory(Models\User::class)->create(['email' => '[email protected]']);

factory(Article::class)->create(['title' => 'Hello alpha', 'user_id' => $john->id]);
factory(Article::class)->create(['title' => 'Hello beta', 'user_id' => $john->id]);
factory(Article::class)->create(['title' => 'Hello gamma', 'user_id' => $jane->id]);
factory(Article::class)->create(['title' => 'Hello zeta', 'user_id' => $joe->id]);
factory(Models\Article::class)->create(['title' => 'Hello alpha', 'user_id' => $john->id]);
factory(Models\Article::class)->create(['title' => 'Hello beta', 'user_id' => $john->id]);
factory(Models\Article::class)->create(['title' => 'Hello gamma', 'user_id' => $jane->id]);
factory(Models\Article::class)->create(['title' => 'Hello zeta', 'user_id' => $joe->id]);

$query = '
query {
Expand All @@ -400,7 +400,7 @@ public function it_can_order_by_relations_and_have_correct_pagination_count()
}
';

$response = $this->graphql($query);
$response = $this->json('GET', '/graphql', ['query' => $query]);
$result = json_decode($response->getContent())->data->users;
$this->assertEquals(3, $result->pagination->total);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class IntegrationTest extends TestCase
*
* @return void
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Traits/BakeryTransactionalAwareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BakeryTransactionalAwareTest extends IntegrationTest
/**
* Set up the tests.
*/
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/TypeRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TypeRegistryTest extends IntegrationTest
/**
* Set up the tests.
*/
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Types/FieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FieldTest extends IntegrationTest
/**
* Set up the tests.
*/
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down

0 comments on commit 519ee7b

Please sign in to comment.