Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit 0d1f7a2

Browse files
committed
first commit.
0 parents  commit 0d1f7a2

File tree

9 files changed

+181
-0
lines changed

9 files changed

+181
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.vscode

Dockerfile-with-xdebug

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
FROM issue-without-xdebug
3+
4+
## activate xdebug
5+
COPY files/xdebug.ini /etc/php7/conf.d/

Dockerfile-without-xdebug

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
FROM alpine:3.7
3+
4+
ENV PHP_VERSION=7.1.15-r0
5+
ENV PHP_XDEBUG_VERSION=2.5.5-r0
6+
7+
## Install PHP for Laravel
8+
RUN addgroup -g 82 -S www-data \
9+
&& adduser -h /var/www -g www-data -s /sbin/nologin -G www-data -SDH -u 82 www-data \
10+
&& apk add --no-cache \
11+
php7=$PHP_VERSION \
12+
php7-ctype=$PHP_VERSION \
13+
php7-dom=$PHP_VERSION \
14+
php7-json=$PHP_VERSION \
15+
php7-mbstring=$PHP_VERSION \
16+
php7-openssl=$PHP_VERSION \
17+
php7-pdo=$PHP_VERSION \
18+
php7-pdo_sqlite=$PHP_VERSION \
19+
php7-phar=$PHP_VERSION \
20+
php7-session=$PHP_VERSION \
21+
php7-tokenizer=$PHP_VERSION \
22+
php7-xml=$PHP_VERSION \
23+
php7-xdebug=$PHP_XDEBUG_VERSION \
24+
php7-zlib=$PHP_VERSION
25+
26+
## Install Composer for Laravel
27+
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
28+
&& if [ $(wget -O - https://composer.github.io/installer.sig 2>/dev/null) != $(php -r "echo hash_file('SHA384', 'composer-setup.php');") ]; then \
29+
echo 'ERROR: Invalid installer signature'; exit 1 \
30+
;fi \
31+
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer
32+
33+
## Create Laravel Project
34+
RUN composer create-project --prefer-dist laravel/laravel TheTest "5.5.*"
35+
36+
## Setup Working Directory
37+
WORKDIR /TheTest
38+
39+
## Migration database
40+
COPY files/.env /TheTest/
41+
RUN touch /TheTest/database/database.sqlite \
42+
&& php /TheTest/artisan migrate
43+
44+
## Create Dummy 50000 rows
45+
COPY files/DatabaseSeeder.php /TheTest/database/seeds/
46+
RUN php /TheTest/artisan db:seed
47+
48+
## Setup Test Code
49+
COPY files/TestCode.php /TheTest/app/Console/Commands/
50+
CMD [ "php", "artisan", "test" ]

files/.env

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=base64:WlHIT28MjtEixlV50EY1d0ztUHI2mkH/coSoQ3xIsZw=
4+
APP_DEBUG=true
5+
APP_LOG_LEVEL=debug
6+
APP_URL=http://localhost
7+
8+
DB_CONNECTION=sqlite
9+
#DB_HOST=127.0.0.1
10+
#DB_PORT=3306
11+
#DB_DATABASE=homestead
12+
#DB_USERNAME=homestead
13+
#DB_PASSWORD=secret
14+
15+
BROADCAST_DRIVER=log
16+
CACHE_DRIVER=file
17+
SESSION_DRIVER=file
18+
SESSION_LIFETIME=120
19+
QUEUE_DRIVER=sync
20+
21+
REDIS_HOST=127.0.0.1
22+
REDIS_PASSWORD=null
23+
REDIS_PORT=6379
24+
25+
MAIL_DRIVER=smtp
26+
MAIL_HOST=smtp.mailtrap.io
27+
MAIL_PORT=2525
28+
MAIL_USERNAME=null
29+
MAIL_PASSWORD=null
30+
MAIL_ENCRYPTION=null
31+
32+
PUSHER_APP_ID=
33+
PUSHER_APP_KEY=
34+
PUSHER_APP_SECRET=
35+
PUSHER_APP_CLUSTER=mt1

files/DatabaseSeeder.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
use Illuminate\Database\Seeder;
4+
5+
class DatabaseSeeder extends Seeder
6+
{
7+
/**
8+
* Run the database seeds.
9+
*
10+
* @return void
11+
*/
12+
public function run()
13+
{
14+
factory(App\User::class, 50000)->create();
15+
}
16+
}

files/TestCode.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
namespace App\Console\Commands;
3+
4+
use Illuminate\Console\Command;
5+
6+
class TestCode extends Command
7+
{
8+
/**
9+
* The name and signature of the console command.
10+
*
11+
* @var string
12+
*/
13+
protected $signature = 'test';
14+
15+
/**
16+
* The console command description.
17+
*
18+
* @var string
19+
*/
20+
protected $description = 'execute test code';
21+
22+
/**
23+
* Create a new command instance.
24+
*
25+
* @return void
26+
*/
27+
public function __construct()
28+
{
29+
parent::__construct();
30+
}
31+
32+
/**
33+
* Execute the console command.
34+
*
35+
* @return mixed
36+
*/
37+
public function handle()
38+
{
39+
$time = microtime(true);
40+
$users = \App\User::all();
41+
$time = microtime(true) - $time;
42+
$this->info($users->count() . ' object readed.');
43+
$this->info('time=' . $time);
44+
}
45+
}

files/xdebug.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
zend_extension=xdebug.so
3+
xdebug.remote_enable=Off
4+
xdebug.remote_autostart=Off

run_test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
echo -------------------------------- Build Test WITHOUT xdebug --------------------------------
4+
docker build -t issue-without-xdebug -f Dockerfile-without-xdebug .
5+
6+
echo -------------------------------- Build Test WITH xdebug --------------------------------
7+
docker build -t issue-with-xdebug -f Dockerfile-with-xdebug .
8+
9+
echo -------------------------------- Run Test WITHOUT xdebug --------------------------------
10+
docker run -it --rm issue-without-xdebug
11+
12+
echo -------------------------------- Run Test WITH xdebug --------------------------------
13+
docker run -it --rm issue-with-xdebug

0 commit comments

Comments
 (0)