Skip to content

Instantly share code, notes, and snippets.

@tobiastom
Created October 17, 2018 12:38
Show Gist options
  • Save tobiastom/0382136867b51747baa51ef7ceac81ab to your computer and use it in GitHub Desktop.
Save tobiastom/0382136867b51747baa51ef7ceac81ab to your computer and use it in GitHub Desktop.
<?php
class Foo {
public $headerCallback = 'headers_send';
public function headers() : array {
return call_user_func( $this->headerCallback );
}
}
class FooTest {
public function testHeaders() {
$headers = [
'foo' => 'bar'
];
$foo = new Foo;
$foo->headersCallback = function() use ( $headers ) {
return $headers;
}
$this->assertSame( $headers, $foo->headers() );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment