Skip to content

Commit

Permalink
Refactor tests to use FakeNonFinalClass
Browse files Browse the repository at this point in the history
Updated several test cases in AspectTest.php to replace FakeMyClass with FakeNonFinalClass. This ensures consistency throughout the tests and aligns with recent changes in the class structure. All assertions have been modified accordingly to reflect this update.
  • Loading branch information
koriym committed Nov 4, 2024
1 parent cf605e1 commit 3e648de
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/Aspect/AspectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ public function testNewInstance(): void
new StartsWithMatcher('my'),
[new FakeMyInterceptor()]
);
$myClass = $this->aspect->newInstance(FakeMyClass::class);
$this->assertNotSame(get_class($myClass), FakeMyClass::class);
$myClass = $this->aspect->newInstance(FakeNonFinalClass::class);

Check failure on line 45 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
$this->assertNotSame(get_class($myClass), FakeNonFinalClass::class);

Check failure on line 46 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
$result = $myClass->myMethod();

Check failure on line 47 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Call to method myMethod() on an unknown class Ray\Aop\FakeNonFinalClass.
// the original method is intercepted
$this->assertEquals('intercepted original', $result);
}

public function testNewInstanceWithNoBound(): void
{
$insntance = $this->aspect->newInstance(FakeMyClass::class);
$this->assertInstanceOf(FakeMyClass::class, $insntance);
$insntance = $this->aspect->newInstance(FakeNonFinalClass::class);

Check failure on line 54 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
$this->assertInstanceOf(FakeNonFinalClass::class, $insntance);

Check failure on line 55 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
}

/**
Expand Down Expand Up @@ -99,8 +99,8 @@ public function testAnnotateMatcher(): void
[new FakeMyInterceptor()]
);

$billing = $aspect->newInstance(FakeMyClass::class);
$this->assertInstanceOf(FakeMyClass::class, $billing);
$billing = $aspect->newInstance(FakeNonFinalClass::class);

Check failure on line 102 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
$this->assertInstanceOf(FakeNonFinalClass::class, $billing);

Check failure on line 103 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
}

/**
Expand All @@ -116,8 +116,8 @@ public function testNotClassMatch(): void
[new FakeMyInterceptor()]
);
$aspect->weave(__DIR__ . '/Fake');
$billing = $aspect->newInstance(FakeMyClass::class);
$this->assertInstanceOf(FakeMyClass::class, $billing);
$billing = $aspect->newInstance(FakeNonFinalClass::class);

Check failure on line 119 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
$this->assertInstanceOf(FakeNonFinalClass::class, $billing);

Check failure on line 120 in tests/Aspect/AspectTest.php

View workflow job for this annotation

GitHub Actions / sa / PHPStan

Class Ray\Aop\FakeNonFinalClass not found.
}

/**
Expand All @@ -133,7 +133,7 @@ public function testNotMethodMatch(): void
[new FakeMyInterceptor()]
);
$aspect->weave(__DIR__ . '/Fake/src');
$billing = $aspect->newInstance(FakeMyClass::class);
$this->assertInstanceOf(FakeMyClass::class, $billing);
$billing = $aspect->newInstance(FakeNonFinalClass::class);
$this->assertInstanceOf(FakeNonFinalClass::class, $billing);
}
}

0 comments on commit 3e648de

Please sign in to comment.