array-object-array/tests/Sikofitt/Tests/ArrayObjectArrayTest.php

75 lines
1.9 KiB
PHP
Raw Normal View History

2016-07-19 14:54:35 -07:00
<?php
2016-07-19 15:02:23 -07:00
/*
2016-07-19 14:54:35 -07:00
* This file is part of ArrayObjectArray.
*
2016-07-19 15:03:05 -07:00
<<<<<<< HEAD
2016-07-19 15:02:23 -07:00
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
2016-07-19 15:03:05 -07:00
=======
2016-07-19 14:54:35 -07:00
* @file ArrayObjectArrayTest.php
*
2016-07-19 14:59:17 -07:00
* R. Eric Wheeler <sikofitt@gmail.com>
2016-07-19 14:54:35 -07:00
*
* 7/19/16 / 1:58 PM
2016-07-19 15:03:05 -07:00
>>>>>>> refs/remotes/origin/master
2016-07-19 14:54:35 -07:00
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Tests;
use Sikofitt\Utility\ArrayObjectArray;
/**
2016-07-19 15:02:23 -07:00
* Class ArrayObjectArrayTest.
2016-07-19 14:54:35 -07:00
*/
2016-07-19 15:02:23 -07:00
class ArrayObjectArrayTest extends \PHPUnit_Framework_TestCase
{
private $arrayObjectArray;
private $workingArray;
2016-07-19 14:54:35 -07:00
2016-07-19 15:02:23 -07:00
public function setUp()
{
$this->workingArray = array(
'this' => 'that',
'that' => 'this',
'what' => 'who',
2016-07-19 14:54:35 -07:00
'check' => 'out',
);
2016-07-19 15:02:23 -07:00
$this->arrayObjectArray = new ArrayObjectArray($this->workingArray);
}
2016-07-19 14:54:35 -07:00
/**
* @coversDefaultClass
*/
2016-07-19 15:02:23 -07:00
public function testArrayObjectArrayInstance()
{
$this->assertInstanceOf(ArrayObjectArray::class, $this->arrayObjectArray);
$this->assertInstanceOf(\ArrayObject::class, $this->arrayObjectArray);
2016-07-19 14:54:35 -07:00
}
2016-07-19 15:02:23 -07:00
public function testArrayKeys()
{
$this->assertSame(array_keys($this->workingArray), $this->arrayObjectArray->array_keys());
$this->assertSame(array_values($this->workingArray), $this->arrayObjectArray->array_values());
2016-07-19 14:54:35 -07:00
2016-07-19 15:02:23 -07:00
$this->assertSame($this->workingArray, $this->arrayObjectArray->getArrayCopy());
$this->assertCount(4, $this->arrayObjectArray);
2016-07-19 14:54:35 -07:00
2016-07-19 15:02:23 -07:00
$this->arrayObjectArray->offsetUnset('this');
$this->assertCount(3, $this->arrayObjectArray);
$this->arrayObjectArray->append(array('this' => 'that'));
$this->assertCount(4, $this->arrayObjectArray);
}
2016-07-19 14:54:35 -07:00
/**
* @expectedException \BadMethodCallException
*/
public function testException()
{
2016-07-19 15:02:23 -07:00
$this->arrayObjectArray->error();
2016-07-19 14:54:35 -07:00
}
}