-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* iteration * iteration2 * iteration3 * iteration5 * iteration8 * cs * use owner and local keys + tests * iteration * iteration2 * iteration3 * iteration4 * iteration7 * finish * typo
- Loading branch information
Showing
7 changed files
with
104 additions
and
33 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
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
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,49 @@ | ||
<?php | ||
|
||
namespace Fico7489\Laravel\EloquentJoin\Tests\Tests; | ||
|
||
use Fico7489\Laravel\EloquentJoin\Tests\Models\Key\Order; | ||
use Fico7489\Laravel\EloquentJoin\Tests\Models\Key\Seller; | ||
use Fico7489\Laravel\EloquentJoin\Tests\TestCase; | ||
|
||
class KeysOwnerTest extends TestCase | ||
{ | ||
public function testBelogsTo() | ||
{ | ||
Order::joinRelations('sellerOwner') | ||
->get(); | ||
|
||
$queryTest = 'select key_orders.* | ||
from "key_orders" | ||
left join "key_sellers" on "key_sellers"."id_seller_owner" = "key_orders"."id_seller_foreign" | ||
group by "key_orders"."id_order_primary"'; | ||
|
||
$this->assertQueryMatches($queryTest, $this->fetchQuery()); | ||
} | ||
|
||
public function testHasOne() | ||
{ | ||
Seller::joinRelations('locationOwner') | ||
->get(); | ||
|
||
$queryTest = 'select key_sellers.* | ||
from "key_sellers" | ||
left join "key_locations" on "key_locations"."id_seller_foreign" = "key_sellers"."id_seller_owner" | ||
group by "key_sellers"."id_seller_primary"'; | ||
|
||
$this->assertQueryMatches($queryTest, $this->fetchQuery()); | ||
} | ||
|
||
public function testHasMany() | ||
{ | ||
Seller::joinRelations('locationsOwner') | ||
->get(); | ||
|
||
$queryTest = 'select key_sellers.* | ||
from "key_sellers" | ||
left join "key_locations" on "key_locations"."id_seller_foreign" = "key_sellers"."id_seller_owner" | ||
group by "key_sellers"."id_seller_primary"'; | ||
|
||
$this->assertQueryMatches($queryTest, $this->fetchQuery()); | ||
} | ||
} |
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