Skip to content

Commit

Permalink
[#13439] - Work on traits and fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed May 9, 2019
1 parent 03edcbc commit 842012b
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
28 changes: 28 additions & 0 deletions tests/_data/fixtures/Traits/ApcuTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon\Test\Fixtures\Traits;

use UnitTester;

/**
* Trait RedisTrait
*
* @package Phalcon\Test\Fixtures\Traits
*/
trait ApcuTrait
{
public function _before(UnitTester $I)
{
$I->checkExtensionIsLoaded('apcu');
}
}
48 changes: 48 additions & 0 deletions tests/_data/fixtures/Traits/LibmemcachedTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon\Test\Fixtures\Traits;

use UnitTester;

/**
* Trait FileTrait
*
* @package Phalcon\Test\Fixtures\Traits\Cache
*/
trait LibmemcachedTrait
{
/**
* @param UnitTester $I
*/
public function _before(UnitTester $I)
{
$I->checkExtensionIsLoaded('memcached');
}

/**
* @return array
*/
protected function getOptions(): array
{
return [
'client' => [],
'servers' => [
[
'host' => env('DATA_MEMCACHED_HOST', '127.0.0.1'),
'port' => env('DATA_MEMCACHED_PORT', 11211),
'weight' => env('DATA_MEMCACHED_WEIGHT', 0),
],
],
];
}
}
6 changes: 5 additions & 1 deletion tests/_data/fixtures/Traits/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ trait RedisTrait
public function _before(UnitTester $I)
{
$I->checkExtensionIsLoaded('redis');
$this->options = $this->getOptions();
}

$this->options = [
protected function getOptions(): array
{
return [
'host' => env('DATA_REDIS_HOST'),
'port' => env('DATA_REDIS_PORT'),
'index' => env('DATA_REDIS_NAME'),
Expand Down

0 comments on commit 842012b

Please sign in to comment.