Added closure and anonymous class to hook formatter test.

This commit is contained in:
Andrey Savchenko committed 2018-12-28 15:02:52 +02:00
1 parent 5356df262f
commit df8c9b1678
1 file changed
+5 -1
+5 -1
View File
@@ -44,12 +44,16 @@ class HookTest extends LapsTestCase {
$hook = [ $hook = [
[ [ 'function' => 'function', 'accepted_args' => 2 ] ], [ [ 'function' => 'function', 'accepted_args' => 2 ] ],
[ [ 'function' => [ 'class', 'method' ], 'accepted_args' => 1 ] ], [ [ 'function' => [ 'class', 'method' ], 'accepted_args' => 1 ] ],
[ [ 'function' => function() {}, 'accepted_args' => 1 ] ],
[ [ 'function' => new class(){}, 'accepted_args' => 1 ] ],
]; ];
$result = $formatter->format( $hook ); $result = $formatter->format( $hook );
$this->assertInternalType( 'array', $result ); $this->assertInternalType( 'array', $result );
$this->assertArraySubset( [ 'function(2)', 'class::method' ], array_values( $result ) ); $this->assertArraySubset( [ 'function(2)', 'class::method' ], $result );
$this->assertStringStartsWith( 'closure from', $result[2] );
$this->assertStringStartsWith( 'anonymous class from', $result[3] );
} }
} }