Skip to content
Snippets Groups Projects
Commit 4f6b1c14 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Move Utils_ArraysTest to SimpleSAML\Test\Utils\ArraysTest.

parent 143e57b1
No related branches found
No related tags found
No related merge requests found
<?php
namespace SimpleSAML\Test\Utils;
use SimpleSAML\Utils\Arrays;
/**
* Tests for SimpleSAML\Utils\Arrays.
*/
class Utils_ArraysTest extends PHPUnit_Framework_TestCase
class ArraysTest extends \PHPUnit_Framework_TestCase
{
/**
......@@ -14,23 +17,23 @@ class Utils_ArraysTest extends PHPUnit_Framework_TestCase
{
// check with empty array as input
$array = array();
$this->assertEquals($array, SimpleSAML\Utils\Arrays::arrayize($array));
$this->assertEquals($array, Arrays::arrayize($array));
// check non-empty array as input
$array = array('key' => 'value');
$this->assertEquals($array, SimpleSAML\Utils\Arrays::arrayize($array));
$this->assertEquals($array, Arrays::arrayize($array));
// check indexes are ignored when input is an array
$this->assertArrayNotHasKey('invalid', SimpleSAML\Utils\Arrays::arrayize($array, 'invalid'));
$this->assertArrayNotHasKey('invalid', Arrays::arrayize($array, 'invalid'));
// check default index
$expected = array('string');
$this->assertEquals($expected, SimpleSAML\Utils\Arrays::arrayize($expected[0]));
$this->assertEquals($expected, Arrays::arrayize($expected[0]));
// check string index
$index = 'key';
$expected = array($index => 'string');
$this->assertEquals($expected, SimpleSAML\Utils\Arrays::arrayize($expected[$index], $index));
$this->assertEquals($expected, Arrays::arrayize($expected[$index], $index));
}
......@@ -41,11 +44,11 @@ class Utils_ArraysTest extends PHPUnit_Framework_TestCase
{
// check bad arrays
$this->assertFalse(
SimpleSAML\Utils\Arrays::transpose(array('1', '2', '3')),
Arrays::transpose(array('1', '2', '3')),
'Invalid two-dimensional array was accepted'
);
$this->assertFalse(
SimpleSAML\Utils\Arrays::transpose(array('1' => 0, '2' => '0', '3' => array(0))),
Arrays::transpose(array('1' => 0, '2' => '0', '3' => array(0))),
'Invalid elements on a two-dimensional array were accepted'
);
......@@ -70,7 +73,7 @@ class Utils_ArraysTest extends PHPUnit_Framework_TestCase
);
$this->assertEquals(
$transposed,
SimpleSAML\Utils\Arrays::transpose($array),
Arrays::transpose($array),
'Unexpected result of transpose()'
);
......@@ -95,7 +98,7 @@ class Utils_ArraysTest extends PHPUnit_Framework_TestCase
);
$this->assertEquals(
$transposed,
SimpleSAML\Utils\Arrays::transpose($array),
Arrays::transpose($array),
'Unexpected result of transpose()'
);
......@@ -122,7 +125,7 @@ class Utils_ArraysTest extends PHPUnit_Framework_TestCase
);
$this->assertEquals(
$transposed,
SimpleSAML\Utils\Arrays::transpose($array),
Arrays::transpose($array),
'Unexpected result of transpose()'
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment