Skip to content

Commit

Permalink
WIP fix unit tests #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef Stich committed May 28, 2024
1 parent 706f220 commit b2d0904
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Test/Case/Model/Behaviors/FilteredBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FilteredBehaviorTest extends \PHPUnit\Framework\TestCase
);

/**
* @var Document|Document2|Document3
* @var AppModel|Document|Document2|Document3
*/
public $Document;

Expand All @@ -47,9 +47,10 @@ public function setUp(): void
parent::setUp();
$Document = ClassRegistry::init('Document');

if ($Document instanceof Document) {
if ($Document instanceof AppModel) {
$this->Document = $Document;
} else {
var_dump(get_class($Document));
throw new Exception('Can not create Document model');
}
}
Expand All @@ -72,7 +73,7 @@ public function testBlankAttaching(): void
{
$this->Document->Behaviors->attach('Filter.Filtered');
$isBehaviorAttached = $this->Document->Behaviors->enabled('Filtered');
$this->assertInternalType('bool', $isBehaviorAttached);
$this->assertIsBool($isBehaviorAttached);
if (is_bool($isBehaviorAttached)) {
$this->assertTrue($isBehaviorAttached);
}
Expand Down Expand Up @@ -153,7 +154,7 @@ public function testLoadingRequiredFieldValueMissing(): void
);
$this->Document->setFilterValues($filterValues);

$this->setExpectedException('PHPUnit_Framework_Error_Notice');
$this->expectException('PHPUnit_Framework_Error_Notice');
$this->Document->find('first');
}

Expand Down Expand Up @@ -629,7 +630,7 @@ public function testExitWhenNoSettings(): void
public function testBeforeDataFilterCallbackCancel(): void
{
$document2 = ClassRegistry::init('Document2');
if ($document2 instanceof Document2) {
if ($document2 instanceof AppModel) {
$this->Document = $document2;
} else {
throw new Exception('Can not create Document2 model');
Expand Down Expand Up @@ -669,7 +670,7 @@ public function testBeforeDataFilterCallbackCancel(): void
public function testAfterDataFilterCallbackQueryChange(): void
{
$document = ClassRegistry::init('Document3');
if ($document instanceof Document3) {
if ($document instanceof AppModel) {
$this->Document = $document;
} else {
throw new Exception('Can not create Document3 model');
Expand Down

0 comments on commit b2d0904

Please sign in to comment.