Skip to content

Commit

Permalink
v73.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Feb 20, 2024
1 parent 85acebe commit 9f4fd56
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Feature/Models/ModelCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function verifyRelationship(string $relationshipType, string $accessor):

$modelClass = $this->getModelClass();

if (! in_array(HasFactory::class, class_uses_recursive($modelClass))
if (in_array(HasFactory::class, class_uses_recursive($modelClass))
&& is_callable([$modelClass, 'factory'])
) {
/**
Expand Down Expand Up @@ -323,11 +323,13 @@ public function verifyRelationshipHasOne(Model $model, string $accessor): void
&& is_string($this->hasOne[$accessor]['rule'])
&& ! empty($this->hasOne[$accessor]['rule'])
? $this->hasOne[$accessor]['rule'] : '';
// dd([
// dump([
// '__METHOD__' => __METHOD__,
// '__FILE__' => __FILE__,
// '__LINE__' => __LINE__,
// '$this->hasOne[$accessor]' => $this->hasOne[$accessor],
// '$this->hasOne' => $this->hasOne,
// '$accessor' => $accessor,
// '$rule' => $rule,
// ]);

/**
Expand All @@ -354,11 +356,13 @@ public function verifyRelationshipHasOne(Model $model, string $accessor): void
$m = $modelClass::factory()->create();
}

// dd([
// dump([
// '__METHOD__' => __METHOD__,
// '__FILE__' => __FILE__,
// '__LINE__' => __LINE__,
// '$m' => $m,
// '$key' => $key,
// '$modelClass' => $modelClass,
// '$m' => $m?->toArray(),
// ]);
$this->assertInstanceOf($modelClass, $m, sprintf(
'Expecting the created HasOne model for the accessor [%1$s] to be an instance of %2$s - found: %3$s - %4$s',
Expand All @@ -370,9 +374,8 @@ public function verifyRelationshipHasOne(Model $model, string $accessor): void

$model->setAttribute($key, $m->getAttribute('id'));

if ($model->save()) {
$model->refresh();
}
$model->save();
$model->refresh();

$this->assertSame(
// strval($model->getAttributeValue($key)),
Expand Down

0 comments on commit 9f4fd56

Please sign in to comment.