60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
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;
|
|
|
|
public $array = [
|
|
"key_one" => "Value One",
|
|
"key_two" => "Value Two"
|
|
];
|
|
|
|
public function _before( UnitTester $I )
|
|
{
|
|
$this->arrayObject = new ArrayObject( $this->array );
|
|
}
|
|
|
|
public function _after( UnitTester $I )
|
|
{
|
|
}
|
|
|
|
public function testArrayAsProps( UnitTester $I )
|
|
{
|
|
$I->assertEquals( $this->arrayObject->key_one, "Value One" );
|
|
}
|
|
|
|
/**
|
|
* undocumented function
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testArrayContains( UnitTester $I )
|
|
{
|
|
$I->assertTrue( $this->arrayObject->contains( "Value One" ) );
|
|
$I->assertFalse( $this->arrayObject->contains( "Not in array" ) );
|
|
}
|
|
|
|
/**
|
|
* undocumented function
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testToTable( UnitTester $I )
|
|
{
|
|
$table = $this->arrayObject->toTable();
|
|
|
|
$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 );
|
|
}
|
|
}
|