Tried something like
image: php:7-fpm
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -qy git curl libmcrypt-dev mysql-client zip unzip
- yes | pecl install mcrypt-1.0.1
- docker-php-ext-install pdo_mysql
- bash ./install-composer.sh
- composer install
- ln -f -s .env.pipelines .env
- php artisan migrate
- php artisan serve &
- sleep 3
- ./vendor/bin/phpunit
- curl -vk http://localhost:8000
services:
- mysql
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'homestead'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'homestead'
MYSQL_PASSWORD: 'secret'
or
image: php:7-fpm
pipelines:
default:
- step:
script:
- apt-get update
- apt-get install zip -y
- apt-get install unzip -y
- apt-get install libzip-dev -y
- apt-get install jpegoptim -y
- apt-get install optipng -y
- apt-get install curl -y
- apt-get install curl -y
- apt-get install mysql-client -y
- apt-get install unzip -y
- docker-php-ext-install zip
- docker-php-ext-install gmp
- docker-php-ext-install bcmath
- docker-php-ext-install pdo_mysql
- yes | pecl install mcrypt-1.0.1
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- php -r "file_exists('.env') || copy('.env.dist', '.env');"
- php artisan key:generate
- php artisan migrate:fresh --seed
- sleep 3
- ./vendor/bin/phpunit
services:
- mysql
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'homestead'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'homestead'
MYSQL_PASSWORD: 'secret'
all functional tests fail, except unit. unit tests work fine.
Anyone??? I have to create many fake accounts only trying to figure out why it is not working according to docs, because i was running out of free time multiple times.
image: php:7-fpm
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -qy git curl libmcrypt-dev mysql-client zip unzip
- yes | pecl install mcrypt-1.0.1
- docker-php-ext-install pdo_mysql
- bash ./install-composer.sh
- composer install
- ln -f -s .env.pipelines .env
- php artisan migrate
- php artisan serve &
- sleep 5
- ./vendor/bin/phpunit
- curl -vk http://localhost:8000
services:
- mysql
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'homestead'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_USER: 'homestead'
MYSQL_PASSWORD: 'secret'
#!/bin/bash
COMPOSER_VERSION=${COMPOSER_VERSION:-1.4.2}
curl -s -f -L -o /tmp/installer.php https://raw.githubusercontent.com/composer/getcomposer.org/da290238de6d63faace0343efbdd5aa9354332c5/web/installer \
&& php -r " \
\$signature = '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410'; \
\$hash = hash('SHA384', file_get_contents('/tmp/installer.php')); \
if (!hash_equals(\$signature, \$hash)) { \
unlink('/tmp/installer.php'); \
echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
exit(1); \
}" \
&& php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
&& rm /tmp/installer.php \
&& composer --ansi --version --no-interaction
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
colors="true"
bootstrap="./vendor/autoload.php"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutTodoAnnotatedTests="true"
stopOnError="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
processIsolation="true"
stopOnFailure="false">
<testsuites>
<testsuite name="Functional">
<directory suffix="Test.php">./tests/Functional</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_URL" value="localhost"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>
APP_ENV=local
APP_KEY=ThisIsThe32CharacterKeySecureKey
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Example test
<?php declare(strict_types=1);
namespace Tests\Functional;
use App\User;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
final class UrlGetAvailabilityTest extends TestCase{
use DatabaseTransactions;
/** * @dataProvider notAuthenticatedUrls
*
* @param string $url
*
* @test
*/
public function WebsiteAvailability_ValidaUrls_SuccessfulResponse(string $url)
{
$response = $this->get($url);
$this->assertTrue($response->isSuccessful(), "Can not access url {$_SERVER['APP_URL']}/$url");
}
Used docs
https://confluence.atlassian.com/bitbucket/php-with-bitbucket-pipelines-873907835.html
https://confluence.atlassian.com/bitbucket/laravel-with-bitbucket-pipelines-913473967.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.