8000 Make sure mutators also are called from pivot constructor by phaza · Pull Request #8900 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

Make sure mutators also are called from pivot constructor #8900

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Fix indentation
  • Loading branch information
phaza committed May 27, 2015
commit 5c4313893fb5d334ad9861b8a3d45c7fe58be890
14 changes: 7 additions & 7 deletions tests/Database/DatabaseEloquentPivotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function testPropertiesAreSetCorrectly()
}

public function testMutatorsAreCalledFromConstructor() {
$parent = m::mock('Illuminate\Database\Eloquent\Model[getConnectionName]');
$parent->shouldReceive('getConnectionName')->once()->andReturn('connection');
$parent = m::mock('Illuminate\Database\Eloquent\Model[getConnectionName]');
$parent->shouldReceive('getConnectionName')->once()->andReturn('connection');

$pivot = new DatabaseEloquentPivotTestMutatorStub($parent, array('foo' => 'bar'), 'table', true);
$pivot = new DatabaseEloquentPivotTestMutatorStub($parent, array('foo' => 'bar'), 'table', true);

$this->assertTrue($pivot->getMutatorCalled());
$this->assertTrue($pivot->getMutatorCalled());
}


Expand Down Expand Up @@ -111,11 +111,11 @@ class DatabaseEloquentPivotTestMutatorStub extends Illuminate\Database\Eloquent\
private $mutatorCalled = false;

public function setFooAttribute($value) {
$this->mutatorCalled = true;
return $value;
$this->mutatorCalled = true;
return $value;
}

public function getMutatorCalled() {
return $this->mutatorCalled;
return $this->mutatorCalled;
}
}
0