-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestCase.php
More file actions
30 lines (24 loc) · 830 Bytes
/
TestCase.php
File metadata and controls
30 lines (24 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace common;
use Dflydev\Hawk\Credentials\Credentials;
use Dflydev\Stack\BasicAuthentication;
use Symfony\Component\HttpKernel\HttpKernelInterface;
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
protected $credentials;
public function setUp()
{
$this->credentials = ['username1234', 'password1234', 'token1234'];
}
protected function basicify(HttpKernelInterface $app, array $config = [])
{
$config = array_merge([
'authenticator' => function ($username = null, $password = null) {
if ($this->credentials[0] === $username && $this->credentials[1] === $password) {
return $this->credentials[2];
}
}
], $config);
return new BasicAuthentication($app, $config);
}
}