Skip to content

Commit ae1c047

Browse files
committed
Make newBuilder() method on Model public
1 parent f7ba6ae commit ae1c047

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ protected function isCompoundKey($key)
657657
*
658658
* @return Builder
659659
*/
660-
protected function newBuilder()
660+
public function newBuilder()
661661
{
662662
return new Builder($this);
663663
}

tests/ModelTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function testHasMany()
124124
$model = new Model($client, 'Job');
125125
$model->job = '12345';
126126
$related = Mockery::mock(Model::class);
127+
$related->shouldReceive('newBuilder')->passthru();
127128
$client->shouldReceive('model')->with('JobPart')->once()->andReturn($related);
128129
$builder = $model->hasMany('JobPart', 'job');
129130
$this->assertInstanceOf(Builder::class, $builder);
@@ -138,6 +139,7 @@ public function testHasManyWithCompoundKey()
138139
$model = new Model($client, 'JobPart');
139140
$model->primaryKey = '12345:01';
140141
$related = Mockery::mock(Model::class);
142+
$related->shouldReceive('newBuilder')->passthru();
141143
$client->shouldReceive('model')->with('JobMaterial')->once()->andReturn($related);
142144
$builder = $model->hasMany('JobMaterial', 'job:jobPart');
143145
$this->assertInstanceOf(Builder::class, $builder);
@@ -155,6 +157,7 @@ public function testMorphMany()
155157
$model = new Model($client, 'Job');
156158
$model->job = '12345';
157159
$related = Mockery::mock(Model::class);
160+
$related->shouldReceive('newBuilder')->passthru();
158161
$client->shouldReceive('model')->with('FileAttachment')->once()->andReturn($related);
159162
$builder = $model->morphMany('FileAttachment');
160163
$this->assertInstanceOf(Builder::class, $builder);

0 commit comments

Comments
 (0)