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 b611c1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 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);
$this->assertNotSame(get_class($myClass), FakeNonFinalClass::class);
$result = $myClass->myMethod();
// 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);
$this->assertInstanceOf(FakeNonFinalClass::class, $insntance);
}

/**
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);
$this->assertInstanceOf(FakeNonFinalClass::class, $billing);
}

/**
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);
$this->assertInstanceOf(FakeNonFinalClass::class, $billing);
}

/**
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Ray\Aop;

class FakeMyClass
class FakeNonFinalClass
{
public function myMethod(): string
{
Expand Down

0 comments on commit b611c1c

Please sign in to comment.