phpcs
This commit is contained in:
parent
8da166736b
commit
ec3e74ffb3
13 changed files with 168 additions and 100 deletions
|
|
@ -1,11 +1,15 @@
|
|||
{
|
||||
"name": "adeattwood/yii-helpers",
|
||||
"description": "Helpers for the yii2 framework",
|
||||
"version": "1",
|
||||
"time": "2017-06-24 11:25:22",
|
||||
"type": "library",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ade Attwood",
|
||||
"email": "attwood16@googlemail.com"
|
||||
"email": "attwood16@googlemail.com",
|
||||
"homepage": "http:/adeattwood.co.uk",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ class ArrayObject extends \ArrayObject
|
|||
/**
|
||||
* __construct
|
||||
*
|
||||
* @param mixed $array
|
||||
* @param mixed $flags
|
||||
* @param string $iterator_class
|
||||
* @param mixed $array The array to put into the array object
|
||||
* @param mixed $flags The falgs of the object
|
||||
* @param string $iterator_class The iterator class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -51,7 +51,7 @@ class ArrayObject extends \ArrayObject
|
|||
/**
|
||||
* Gets a random value from the array
|
||||
*
|
||||
* @param int $count
|
||||
* @param int $count How many items to return
|
||||
*
|
||||
* @return int|array
|
||||
*/
|
||||
|
|
@ -81,17 +81,8 @@ class ArrayObject extends \ArrayObject
|
|||
*
|
||||
* @return string The html for the table
|
||||
*/
|
||||
public function toTable(
|
||||
$transpose = false,
|
||||
$recursive = false,
|
||||
$typeHint = true,
|
||||
$tableOptions = ['class' => 'table table-bordered table-striped'],
|
||||
$keyOptions = [],
|
||||
$valueOptions = ['style' => 'cursor: default; border-bottom: 1px #aaa dashed;'],
|
||||
$null = '<span class="not-set">(not set)</span>'
|
||||
) {
|
||||
|
||||
// Sanity check
|
||||
public function toTable( $transpose = false, $recursive = false, $typeHint = true, $tableOptions = [ 'class' => 'table table-bordered table-striped' ], $keyOptions = [], $valueOptions = [ 'style' => 'cursor: default; border-bottom: 1px #aaa dashed;' ], $null = '<span class="not-set">(not set)</span>' )
|
||||
{
|
||||
if ( empty( ( array )$this ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ class Dumper
|
|||
|
||||
|
||||
foreach ( $methods as $method ) {
|
||||
|
||||
$prop = '';
|
||||
|
||||
if ( $method->isPublic() ) {
|
||||
|
|
|
|||
|
|
@ -2,10 +2,29 @@
|
|||
|
||||
namespace adeattwood\helpers\tests\_data;
|
||||
|
||||
/**
|
||||
* @category PHP
|
||||
* @package adeattwood\yii-helpers
|
||||
* @author Ade Attwood <attwood16@googlemail.com>
|
||||
* @copyright 2017 adeattwood.co.uk
|
||||
* @license BSD-2-Clause http://adeattwood.co.uk/license.html
|
||||
* @link adeattwood.co.uk
|
||||
* @since v0.1
|
||||
*/
|
||||
class ModelOne extends \yii\base\Model
|
||||
{
|
||||
/**
|
||||
* The first test proprety
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $propOne;
|
||||
|
||||
/**
|
||||
* The validation rules for the model
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
<?php
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
/**
|
||||
* @category PHP
|
||||
* @package adeattwood\yii-helpers
|
||||
* @author Ade Attwood <attwood16@googlemail.com>
|
||||
* @copyright 2017 adeattwood.co.uk
|
||||
* @license BSD-2-Clause http://adeattwood.co.uk/license.html
|
||||
* @link adeattwood.co.uk
|
||||
* @since v0.1
|
||||
*/
|
||||
class Unit extends \Codeception\Module
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* @category PHP
|
||||
* @package adeattwood\yii-helpers
|
||||
* @author Ade Attwood <attwood16@googlemail.com>
|
||||
* @copyright 2017 adeattwood.co.uk
|
||||
* @license BSD-2-Clause http://adeattwood.co.uk/license.html
|
||||
* @link adeattwood.co.uk
|
||||
* @since v0.1
|
||||
*
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
|
|
@ -19,8 +26,4 @@
|
|||
class UnitTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@
|
|||
use adeattwood\helpers\ArrayHelper;
|
||||
use adeattwood\helpers\tests\_data\ModelOne;
|
||||
|
||||
/**
|
||||
* @category PHP
|
||||
* @package adeattwood\yii-helpers
|
||||
* @author Ade Attwood <attwood16@googlemail.com>
|
||||
* @copyright 2017 adeattwood.co.uk
|
||||
* @license BSD-2-Clause http://adeattwood.co.uk/license.html
|
||||
* @link adeattwood.co.uk
|
||||
* @since v0.1
|
||||
*/
|
||||
class ArrayHelperCest
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
|
||||
use adeattwood\helpers\ArrayObject;
|
||||
|
||||
/**
|
||||
* @category PHP
|
||||
* @package adeattwood\yii-helpers
|
||||
* @author Ade Attwood <attwood16@googlemail.com>
|
||||
* @copyright 2017 adeattwood.co.uk
|
||||
* @license BSD-2-Clause http://adeattwood.co.uk/license.html
|
||||
* @link adeattwood.co.uk
|
||||
* @since v0.1
|
||||
*/
|
||||
class ArrayObjectCest
|
||||
{
|
||||
public $arrayObject;
|
||||
|
|
@ -48,5 +57,4 @@ class ArrayObjectCest
|
|||
$I->assertContains( '<table class="table table-bordered table-striped">', $table );
|
||||
$I->assertContains( '<span title="string" style="cursor: default; border-bottom: 1px #aaa dashed;">Value One</span>', $table );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
30
tests/unit/EnumCest.php
Normal file
30
tests/unit/EnumCest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use adeattwood\helpers\Enum;
|
||||
|
||||
/**
|
||||
* @category PHP
|
||||
* @package adeattwood\yii-helpers
|
||||
* @author Ade Attwood <attwood16@googlemail.com>
|
||||
* @copyright 2017 adeattwood.co.uk
|
||||
* @license BSD-2-Clause http://adeattwood.co.uk/license.html
|
||||
* @link adeattwood.co.uk
|
||||
* @since v0.1
|
||||
*/
|
||||
class EnumCest
|
||||
{
|
||||
|
||||
public function _before( UnitTester $I )
|
||||
{
|
||||
}
|
||||
|
||||
public function _after( UnitTester $I )
|
||||
{
|
||||
}
|
||||
|
||||
public function testNumberArray( UnitTester $I )
|
||||
{
|
||||
$I->assertEquals( Enum::formatBytes( 28434322.25 ), "27.12 MB" );
|
||||
$I->assertEquals( Enum::formatBytes( 17328347842.25, 3 ), "16.138 GB" );
|
||||
}
|
||||
}
|
||||
|
|
@ -19,4 +19,3 @@ $config = [
|
|||
];
|
||||
|
||||
( new yii\web\Application( $config ) );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue