-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test that asserts PublicKeyCredentialSource can be saved
Run integration tests in pipeline Add doctrine schema validate to pipeline
- Loading branch information
Showing
9 changed files
with
109 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
echo "pulling the images" | ||
docker compose pull | ||
echo "starting the images" | ||
docker compose up -d | ||
echo "intialising the environment" | ||
docker compose exec -T webauthn bash -c ' | ||
cp /var/www/html/config/openconext/parameters.yaml.dist /var/www/html/config/openconext/parameters.yaml && \ | ||
composer install --prefer-dist -n -o --no-scripts && \ | ||
./bin/console assets:install --verbose && \ | ||
./bin/console cache:clear && \ | ||
chown -R www-data:www-data /var/www/html/var/ && \ | ||
./bin/console doctrine:migrations:migrate --no-interaction | ||
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Don't use this docker setup in production this is solely for testing purposes! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd $(dirname $0)/../../ | ||
|
||
printf "Doctrine schema validate\n" | ||
./bin/console doctrine:schema:validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
tests/Integration/Repository/PublicKeyCredentialSourceRepositoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
/** | ||
* Copyright 2024 SURFnet B.V. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Test\Integration\Repository; | ||
|
||
use Doctrine\ORM\EntityManager; | ||
use Surfnet\Webauthn\Entity\PublicKeyCredentialSource; | ||
use Surfnet\Webauthn\Entity\User; | ||
use Surfnet\Webauthn\Repository\PublicKeyCredentialSourceRepository; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\Component\Uid\UuidV4; | ||
use Webauthn\TrustPath\EmptyTrustPath; | ||
|
||
class PublicKeyCredentialSourceRepositoryTest extends KernelTestCase | ||
{ | ||
private ?EntityManager $entityManager; | ||
|
||
protected function setUp(): void | ||
{ | ||
$kernel = self::bootKernel(); | ||
|
||
$this->entityManager = $kernel->getContainer() | ||
->get('doctrine') | ||
->getManager(); | ||
} | ||
|
||
|
||
protected function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
|
||
$this->entityManager->close(); | ||
$this->entityManager = null; | ||
} | ||
|
||
public function testRepo() | ||
{ | ||
/** @var PublicKeyCredentialSourceRepository $repo */ | ||
$repo = $this->entityManager->getRepository(PublicKeyCredentialSource::class); | ||
|
||
$item = new PublicKeyCredentialSource( | ||
'id', | ||
'type', | ||
['transports'], | ||
'attestationType', | ||
new EmptyTrustPath(), | ||
UuidV4::v4(), | ||
'credentialPublicKey', | ||
'userHandle', | ||
1, | ||
'fmt' | ||
); | ||
|
||
$repo->saveCredentialSource($item); | ||
|
||
$result = $repo->allForUser(new User('userHandle', 'foo', 'bar')); | ||
|
||
$this->assertNotEmpty($result); | ||
} | ||
|
||
} |