GitHub

Original file line numberDiff line numberDiff line change

@@ -16,6 +16,7 @@

1616

use Codeception\Lib\Interfaces\MultiSession;

1717

use Codeception\Lib\Interfaces\PartedModule;

1818

use Codeception\TestInterface;

19+

use PHPUnit\Framework\Assert;

1920

use ReflectionClass;

2021

use RuntimeException;

2122

use Symfony\Component\BrowserKit\CookieJar;

@@ -647,7 +648,7 @@ public function haveRecord(string $model, $attributes = []): int|string|array

647648

$record = \Yii::createObject($model);

648649

$record->setAttributes($attributes, false);

649650

if (! $record->save(false)) {

650-

$this->fail("Record $model was not saved: " . \yii\helpers\Json::encode($record->errors));

651+

Assert::fail("Record $model was not saved: " . \yii\helpers\Json::encode($record->errors));

651652

}

652653

return $record->getPrimaryKey();

653654

}

@@ -667,7 +668,7 @@ public function seeRecord(string $model, array $attributes = []): void

667668

{

668669

$record = $this->findRecord($model, $attributes);

669670

if (! $record) {

670-

$this->fail("Couldn't find $model with " . json_encode($attributes));

671+

Assert::fail("Couldn't find $model with " . json_encode($attributes));

671672

}

672673

$this->debugSection($model, json_encode($record));

673674

}

@@ -688,7 +689,7 @@ public function dontSeeRecord(string $model, array $attributes = []): void

688689

$record = $this->findRecord($model, $attributes);

689690

$this->debugSection($model, json_encode($record));

690691

if ($record) {

691-

$this->fail("Unexpectedly managed to find $model with " . json_encode($attributes));

692+

Assert::fail("Unexpectedly managed to find $model with " . json_encode($attributes));

692693

}

693694

}

694695

Read the original on github.com ↗