ソースを参照

add redis testing.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
pull/1/merge
Bo-Yi Wu 4年前
コミット
7e34eefefc
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: F84B2110C500B1F
6個のファイルの変更76行の追加8行の削除
  1. +1
    -0
      .drone.yml
  2. +2
    -2
      .env.example
  3. +2
    -1
      composer.json
  4. +51
    -1
      composer.lock
  5. +1
    -1
      phpunit.xml
  6. +19
    -3
      tests/Feature/UserTest.php

+ 1
- 0
.drone.yml ファイルの表示

@ -20,6 +20,7 @@ pipeline:
commands:
- php -v
- composer -V
- cp .env.example .env
- composer install --prefer-dist
- ./vendor/bin/phpunit

+ 2
- 2
.env.example ファイルの表示

@ -14,10 +14,10 @@ DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_DRIVER=redis
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

+ 2
- 1
composer.json ファイルの表示

@ -7,7 +7,8 @@
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0"
"laravel/tinker": "~1.0",
"predis/predis": "^1.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",

+ 51
- 1
composer.lock ファイルの表示

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "96098e473b028cdb2529580554a1ae3e",
"content-hash": "0b52c14e250aa32e05b69b2daf66787f",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@ -784,6 +784,56 @@
],
"time": "2017-03-13T16:27:32+00:00"
},
{
"name": "predis/predis",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/nrk/predis.git",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
"reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"suggest": {
"ext-curl": "Allows access to Webdis when paired with phpiredis",
"ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
},
"type": "library",
"autoload": {
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniele Alessandri",
"email": "suppakilla@gmail.com",
"homepage": "http://clorophilla.net"
}
],
"description": "Flexible and feature-complete Redis client for PHP and HHVM",
"homepage": "http://github.com/nrk/predis",
"keywords": [
"nosql",
"predis",
"redis"
],
"time": "2016-06-16T16:22:20+00:00"
},
{
"name": "psr/log",
"version": "1.0.2",

+ 1
- 1
phpunit.xml ファイルの表示

@ -25,7 +25,7 @@
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="redis"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>

+ 19
- 3
tests/Feature/UserTest.php ファイルの表示

@ -3,9 +3,6 @@
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class UserTest extends TestCase
{
@ -18,4 +15,23 @@ class UserTest extends TestCase
{
$this->assertTrue(true);
}
/**
* A basic test example.
*
* @return void
*/
public function testRedis()
{
// Retrieve a piece of data from the session...
$value = session('key');
// Specifying a default value...
$value = session('key', 'default');
$this->assertEquals('default', session('key', 'default'));
// Store a piece of data in the session...
session(['key' => 'value']);
$this->assertEquals('value', session('key', 'default'));
}
}

読み込み中…
キャンセル
保存