Skip to content

Commit

Permalink
#201: Add red test
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Sep 5, 2023
1 parent 18f58cf commit f749c5f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/CompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,11 @@ public function testCompileMultipleFile(): void
$bind = (new Bind())->bindInterceptors('foo', [new FakeDoubleInterceptor()]);
$compiler->newInstance(FakeTwoClass::class, [], $bind);
}

public function testNewInstanceWithAnonymousClass(): void
{
$mock = $this->compiler->newInstance(FakeAnonymousClass::class, [], $this->bind);
$this->assertInstanceOf(FakeAnonymousClass::class, $mock);
$this->assertInstanceOf(WeavedInterface::class, $mock);
}
}
13 changes: 13 additions & 0 deletions tests/Fake/FakeAnonymousClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Ray\Aop;

class FakeAnonymousClass
{
public function hasAnonymousClass($a): object
{
return new class {};
}
}

0 comments on commit f749c5f

Please sign in to comment.