Added laravel framework. Bootstrap absolute minimum. Add testing framework that follows Laravel practices. Write simple feature test to test caching.

This commit is contained in:
Taylor Dondich
2017-07-27 14:04:51 -07:00
committed by davidcallizaya
parent 5874fce1b5
commit 6458dc64a1
11 changed files with 2786 additions and 494 deletions

66
bootstrap/app.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
Illuminate\Foundation\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
Illuminate\Foundation\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
Illuminate\Foundation\Exceptions\Handler::class
);
$app->configureMonologUsing(function($monolog) use ($app) {
$monolog->pushHandler(
(new Monolog\Handler\RotatingFileHandler(
// Set the log path
$app->storagePath().'/logs/processmaker.log',
// Set the number of daily files you want to keep
$app->make('config')->get('app.log_max_files', 5)
))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true, true))
);
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

2
bootstrap/cache/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -27,6 +27,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"laravel/framework": "5.4.*",
"luracast/restler": "^3.0",
"bshaffer/oauth2-server-php": "v1.0",
"colosa/pmUI": "develop-dev",
@@ -46,7 +47,7 @@
},
"require-dev": {
"guzzle/guzzle": "~3.1.1",
"behat/behat": "2.4.*@stable"
"phpunit/phpunit": "~5.7"
},
"autoload": {
"psr-0": {
@@ -78,5 +79,10 @@
"thirdparty/HTMLPurifier/HTMLPurifier.auto.php",
"workflow/engine/classes/class.pmFunctions.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
}
}

2958
composer.lock generated

File diff suppressed because it is too large Load Diff

18
config/app.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
return [
'name' => env('APP_NAME', 'ProcessMaker'),
'env' => env('APP_ENV', 'production'),
'debug' => env('APP_DEBUG', false),
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
'providers' => [
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
],
'aliases' => [
],
];

91
config/cache.php Normal file
View File

@@ -0,0 +1,91 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'processmaker',
];

27
config/view.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),
];

View File

@@ -1,55 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true"
syntaxCheck="true"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="automated">
<directory>./tests/automated/</directory>
</testsuite>
<!--
<testsuite name="unit">
<directory>./tests/unit/</directory>
</testsuite>
-->
<testsuite name="api">
<directory>./workflow/engine/src/</directory>
</testsuite>
</testsuites>
stopOnFailure="false">
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<!-- <filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./gulliver</directory>
<directory>./workflow</directory>
<directory>./rbac</directory>
</exclude>
</whitelist>
</filter> -->
<php>
<var name="SYS_SYS" value="os" />
<var name="SYS_LANG" value="en" />
<var name="SYS_SKIN" value="classic" />
<var name="zDB_ADAPTER" value="mysql" />
<var name="zDB_HOST" value="localhost" />
<var name="zDB_NAME" value="wf_os" />
<var name="zDB_USER" value="root" />
<var name="zDB_PASS" value="password" />
<var name="PATH_DB" value="/shared/workflow_data/sites/" />
<var name="PATH_DATA" value="/shared/workflow_data/sites/" />
</php>
<logging>
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="memcached"/>
</php>
</phpunit>

View File

@@ -0,0 +1,17 @@
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Tests\Feature;
use Illuminate\Support\Facades\Cache;
use Tests\TestCase;
class CacheTest extends TestCase
{
/**
* A basic cache example.
*
* @return void
*/
public function testCache()
{
Cache::put('foo', 'bar', 5);
$this->assertEquals('bar', (Cache::get('foo')));
}
}

8
tests/TestCase.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}