1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace DMK\MKSamlAuth\Tests\Functional\Store; |
6
|
|
|
|
7
|
|
|
use DMK\MKSamlAuth\Store\CredentialStore; |
8
|
|
|
use Doctrine\DBAL\DriverManager; |
9
|
|
|
use Doctrine\DBAL\Schema\Schema; |
10
|
|
|
use Nimut\TestingFramework\TestCase\FunctionalTestCase; |
11
|
|
|
use PHPUnit\Framework\TestCase; |
12
|
|
|
use TYPO3\CMS\Core\Database\ConnectionPool; |
13
|
|
|
|
14
|
|
|
class CredentialStoreTest extends FunctionalTestCase |
15
|
|
|
{ |
16
|
|
|
protected $testExtensionsToLoad = [ |
17
|
|
|
'typo3conf/ext/mksamlauth' |
18
|
|
|
]; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var CredentialStore |
22
|
|
|
*/ |
23
|
|
|
private $store; |
24
|
|
|
|
25
|
|
|
protected function setUp() |
26
|
|
|
{ |
27
|
|
|
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'] = [ |
28
|
|
|
'driver' => 'pdo_sqlite', |
29
|
|
|
'memory' => true |
30
|
|
|
]; |
31
|
|
|
|
32
|
|
|
parent::setUp(); |
33
|
|
|
|
34
|
|
|
$this->store = new CredentialStore($this->getConnectionPool()); |
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function tearDown() |
38
|
|
|
{ |
39
|
|
|
$this->getConnectionPool()->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME) |
|
|
|
|
40
|
|
|
->exec('TRUNCATE TABLE tx_mksamlauth_domain_model_identityprovider'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
public function testNotExists() |
45
|
|
|
{ |
46
|
|
|
self::markTestSkipped(); |
47
|
|
|
self::assertNull($this->store->getByEntityId('not-exists')); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function _testExists() |
51
|
|
|
{ |
52
|
|
|
self::markTestSkipped(); |
53
|
|
|
$this->getDatabaseConnection() |
54
|
|
|
->insertArray('tx_mksamlauth_domain_model_identityprovider', [ |
55
|
|
|
'name' => 'foo', |
56
|
|
|
'certificate' => file_get_contents(__DIR__.'/../Fixtures/saml.crt'), |
57
|
|
|
'cert_key' => file_get_contents(__DIR__.'/../Fixtures/saml.crt'), |
58
|
|
|
'passphrase' => '123123', |
59
|
|
|
]); |
60
|
|
|
|
61
|
|
|
$credential = $this->store->getByEntityId('foo'); |
62
|
|
|
|
63
|
|
|
self::assertSame( |
64
|
|
|
'foo', |
65
|
|
|
$credential->getEntityId() |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
self::assertSame( |
69
|
|
|
'', |
70
|
|
|
$credential->getCertificate()->getFingerprint() |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
self::assertSame( |
74
|
|
|
'', |
75
|
|
|
$credential->getPrivateKey()->key |
76
|
|
|
); |
77
|
|
|
|
78
|
|
|
self::assertSame( |
79
|
|
|
'', |
80
|
|
|
$credential->getPrivateKey()->passphrase |
81
|
|
|
); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.