Skip to content

Commit

Permalink
Merge pull request #264 from analogueorm/analysis-qJOGwD
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
RemiCollin authored May 4, 2018
2 parents 92e732f + 8f7ab6a commit 8c94143
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/System/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ protected function parseManyRelationship(string $relation): bool
}

$this->relationships[$relation] = $this->createSubAggregates($value, $relation);

return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/System/Proxies/CollectionProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class CollectionProxy extends EntityCollection implements ProxyInterface
protected $pushedItems = [];

/**
* Prepended items
*
* Prepended items.
*
* @var array
*/
protected $prependedItems = [];
Expand Down Expand Up @@ -840,7 +840,7 @@ public function pop()
*/
public function prepend($value, $key = null)
{
$key
$key
? $this->prependedItems[$key] = $value
: $this->prependedItems[] = $value;

Expand Down
19 changes: 9 additions & 10 deletions tests/cases/CollectionProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use Analogue\ORM\System\Proxies\CollectionProxy;
use Illuminate\Support\Collection;
use TestApp\User;
use TestApp\Group;
use TestApp\User;

class CollectionProxyTest extends DomainTestCase
{
Expand Down Expand Up @@ -77,19 +77,19 @@ public function we_can_push_to_a_collection_proxy_without_loading_it()
$id = $this->createRelatedSet(3);
$user = mapper(User::class)->find($id);
$this->assertFalse($user->groups->isProxyInitialized());
$group = new Group;
$group = new Group();
$group->id = 666;
$group->name = "added-test";
$group->name = 'added-test';
$user->groups->push($group);
$this->assertFalse($user->groups->isProxyInitialized());
$this->assertCount(1, $user->groups->getAddedItems());
mapper(User::class)->store($user);
$this->assertDatabaseHas('groups', [
'name' => "added-test",
'name' => 'added-test',
]);
$this->assertDatabaseHas('groups_users', [
'group_id' => 666,
'user_id' => $id,
'user_id' => $id,
]);
}

Expand All @@ -99,26 +99,25 @@ public function we_can_prepend_to_a_collection_proxy_without_loading_it()
$id = $this->createRelatedSet(3);
$user = mapper(User::class)->find($id);
$this->assertFalse($user->groups->isProxyInitialized());
$group = new Group;
$group = new Group();
$group->id = 666;
$group->name = "added-test";
$group->name = 'added-test';
$user->groups->prepend($group);
$this->assertFalse($user->groups->isProxyInitialized());
$this->assertCount(1, $user->groups->getAddedItems());
mapper(User::class)->store($user);
$this->assertDatabaseHas('groups', [
'name' => "added-test",
'name' => 'added-test',
]);
$this->assertDatabaseHas('groups_users', [
'group_id' => 666,
'user_id' => $id,
'user_id' => $id,
]);
}

/** @test */
public function we_can_remove_from_a_collection_proxy_without_loading_it()
{

}

/**
Expand Down

0 comments on commit 8c94143

Please sign in to comment.