Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaudioVarandas committed Apr 15, 2024
1 parent 0463024 commit 4764a9b
Show file tree
Hide file tree
Showing 17 changed files with 2,274 additions and 88 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN set -eux \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& true \
&& docker-php-ext-install pdo pdo_pgsql \
&& true \
&& true \
# mlocati
RUN chmod +x /usr/local/bin/install-php-extension \
&& true \
Expand Down
6 changes: 2 additions & 4 deletions stocks-api/.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ DATABASE_URL="pgsql://user:user@db:5432/stocks_api?serverVersion=16.2&charset=ut
###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=
JWT_PASSPHRASE=bananas
###< lexik/jwt-authentication-bundle ###
#ALPHA_VANTAGE_ACCESS_KEY=TM8PUCMRAVJKA2L5
#ALPHA_VANTAGE_ACCESS_KEY=TVMTR304YAMIFBZ2
ALPHA_VANTAGE_ACCESS_KEY=
ALPHA_VANTAGE_ACCESS_KEY=TM8PUCMRAVJKA2L5
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
Expand Down
8 changes: 8 additions & 0 deletions stocks-api/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# define your env variables for the test env here
APP_ENV=test
APP_SECRET='$ecretf0rt3st'
KERNEL_CLASS='App\Kernel'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
DATABASE_URL="pgsql://hcib:hcib@db:5432/stocks_api_test?serverVersion=16.2&charset=utf8"
10 changes: 10 additions & 0 deletions stocks-api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###


###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
23 changes: 23 additions & 0 deletions stocks-api/bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
7 changes: 6 additions & 1 deletion stocks-api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
"symfony/yaml": "6.4.*"
},
"require-dev": {
"symfony/maker-bundle": "^1.58"
"dama/doctrine-test-bundle": "^8.0",
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "6.4.*",
"symfony/css-selector": "6.4.*",
"symfony/maker-bundle": "^1.58",
"symfony/phpunit-bridge": "^7.0"
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit 4764a9b

Please sign in to comment.