Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 #21

Merged
merged 14 commits into from
Dec 14, 2024
Prev Previous commit
Next Next commit
test: remove dead tests
oliverearl committed Dec 14, 2024
commit 466d92d8aef0409e9ded5c55a9d3f44386c83c15
68 changes: 0 additions & 68 deletions tests/AliasedMethodTest.php
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@

use Petrobolos\FixedArray\FixedArray;

const LEGACY_SKIP_MSG = 'This is a legacy method that does nothing on PHP 8 or above.';

test('count provides the size of the fixed array', function () {
$count = 5;
$array = new SplFixedArray($count);
@@ -12,20 +10,6 @@
$this->assertEquals($count, FixedArray::count($array));
});

test('current returns the current array entry', function () {
if (PHP_VERSION_ID >= 80000) {
/** @phpstan-ignore-next-line */
$this->markTestSkipped(LEGACY_SKIP_MSG);
}

$test = 'test';
$array = new SplFixedArray(1);
$array[0] = 'test';

/** @phpstan-ignore-next-line */
$this->assertEquals($test, FixedArray::current($array));
});

test('from array creates a fixed array from a regular array', function () {
$array = ['test'];
$count = count($array);
@@ -46,31 +30,6 @@
$this->assertEquals($count, FixedArray::getSize($array));
});

test('key returns the current array index', function () {
if (PHP_VERSION_ID >= 80000) {
/** @phpstan-ignore-next-line */
$this->markTestSkipped(LEGACY_SKIP_MSG);
}

$array = new SplFixedArray(5);

/** @phpstan-ignore-next-line */
$this->assertEquals(0, FixedArray::key($array));
});

test('next advances the internal pointer', function () {
if (PHP_VERSION_ID >= 80000) {
/** @phpstan-ignore-next-line */
$this->markTestSkipped(LEGACY_SKIP_MSG);
}

$array = new SplFixedArray(5);
FixedArray::next($array);

/** @phpstan-ignore-next-line */
$this->assertSame(1, FixedArray::key($array));
});

test('offset exists returns whether a given index is occupied', function () {
$array = new SplFixedArray(5);
FixedArray::offsetSet(4, 'test', $array);
@@ -104,20 +63,6 @@
$this->assertSame($test, FixedArray::offsetGet($index, $array));
});

test('rewind resets the internal pointer', function () {
if (PHP_VERSION_ID >= 80000) {
/** @phpstan-ignore-next-line */
$this->markTestSkipped(LEGACY_SKIP_MSG);
}

$array = new SplFixedArray(5);
FixedArray::next($array);
FixedArray::rewind($array);

/** @phpstan-ignore-next-line */
$this->assertSame(0, FixedArray::key($array));
});

test('set size increases the size of a fixed array', function () {
$originalSize = 5;
$array = new SplFixedArray($originalSize);
@@ -145,16 +90,3 @@
/** @phpstan-ignore-next-line */
$this->assertEquals($test, head($convertedArray));
});

test('valid determines if there are any more remaining elements', function () {
if (PHP_VERSION_ID >= 80000) {
/** @phpstan-ignore-next-line */
$this->markTestSkipped(LEGACY_SKIP_MSG);
}

$array = new SplFixedArray(1);
FixedArray::next($array);

/** @phpstan-ignore-next-line */
$this->assertFalse(FixedArray::valid($array));
});