-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from MacPaw/develop
Release
- Loading branch information
Showing
15 changed files
with
300 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,6 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.composer/cache/files | ||
key: ${{ matrix.php }}-${{ matrix.symfony-versions }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
|
@@ -58,17 +53,6 @@ jobs: | |
- name: Add PHPUnit matcher | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Set composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer-${{ hashFiles('composer.json') }} | ||
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer | ||
|
||
- name: Update Symfony version | ||
if: matrix.symfony-versions != '' | ||
run: | | ||
|
@@ -89,8 +73,9 @@ jobs: | |
if: matrix.coverage == 'xdebug' | ||
|
||
- name: Run codecov | ||
uses: codecov/codecov-action@v1 | ||
uses: codecov/codecov-action@v5 | ||
if: matrix.coverage == 'xdebug' | ||
with: | ||
file: './coverage.xml' | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: './coverage.xml' | ||
fail_ci_if_error: true |
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,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyHealthCheckBundle\Check; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use SymfonyHealthCheckBundle\Dto\Response; | ||
use Throwable; | ||
|
||
class DoctrineODMCheck implements CheckInterface | ||
{ | ||
private const CHECK_RESULT_NAME = 'doctrine_odm_check'; | ||
|
||
private ContainerInterface $container; | ||
|
||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
public function check(): Response | ||
{ | ||
/** | ||
* @var object|null $documentManager | ||
*/ | ||
$documentManager = $this->container->get( | ||
'doctrine_mongodb.odm.document_manager', | ||
ContainerInterface::NULL_ON_INVALID_REFERENCE, | ||
); | ||
|
||
if (!$documentManager) { | ||
return new Response(self::CHECK_RESULT_NAME, false, 'Document Manager Not Found.'); | ||
} | ||
|
||
$client = $documentManager->getClient(); | ||
$databaseName = $documentManager->getConfiguration()->getDefaultDB() ?? 'admin'; | ||
|
||
try { | ||
$client->selectDatabase($databaseName)->command(['ping' => 1]); | ||
} catch (Throwable $e) { | ||
return new Response(self::CHECK_RESULT_NAME, false, $e->getMessage()); | ||
} | ||
|
||
return new Response(self::CHECK_RESULT_NAME, true, 'ok'); | ||
} | ||
} |
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
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyHealthCheckBundle\Tests\Mock\DocumentManager; | ||
|
||
class ClientMock | ||
{ | ||
public function selectDatabase(string $databaseName): DatabaseMock | ||
{ | ||
return new DatabaseMock(); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyHealthCheckBundle\Tests\Mock\DocumentManager; | ||
|
||
class ConfigurationMock | ||
{ | ||
public function getDefaultDB(): ?string | ||
{ | ||
return 'default'; | ||
} | ||
} |
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,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyHealthCheckBundle\Tests\Mock\DocumentManager; | ||
|
||
class DatabaseMock | ||
{ | ||
public function command(array $command): void | ||
{ | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyHealthCheckBundle\Tests\Mock\DocumentManager; | ||
|
||
class DocumentManagerMock | ||
{ | ||
public function getConfiguration(): ConfigurationMock | ||
{ | ||
return new ConfigurationMock(); | ||
} | ||
|
||
public function getClient(): ClientMock | ||
{ | ||
return new ClientMock(); | ||
} | ||
} |
Oops, something went wrong.