Skip to content

Commit 60491ec

Browse files
committedFeb 4, 2025·
cleanup for wondernetwork/php-collection-library
1 parent 3714e64 commit 60491ec

14 files changed

+2783
-1324
lines changed
 

‎.github/workflows/ci.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
strategy:
11+
matrix:
12+
php_version: ['8.3']
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: ${{ matrix.php_version }}
21+
- name: Get composer cache directory
22+
id: composer-cache
23+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
24+
- name: Cache dependencies
25+
uses: actions/cache@v4
26+
with:
27+
path: ${{ steps.composer-cache.outputs.dir }}
28+
key: ${{ runner.os }}-composer-${{ matrix.php_version }}-${{ hashFiles('**/composer.lock') }}
29+
restore-keys: ${{ runner.os }}-composer-${{ matrix.php_version }}-
30+
31+
- name: Install dependencies
32+
run: composer install
33+
- name: PHPSpec
34+
run: vendor/bin/phpspec run
35+
- name: PHPUnit
36+
run: vendor/bin/phpunit

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ coverage.clover
55
coverage.xml
66

77
phpunit.xml
8+
.phpunit.cache
9+

‎composer.json

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
{
2-
"name": "martinvenus/knapsack",
2+
"name": "wondernetwork/php-collection-library",
33
"license": "MIT",
44
"type": "library",
55
"description": "Collection library for PHP",
66
"keywords": ["collections","sequences", "map", "reduce"],
7-
"homepage": "https://github.com/DusanKasan/Knapsack",
7+
"homepage": "https://github.com/WonderNetwork/php-collection-library",
88
"authors": [
99
{
1010
"name": "Dusan Kasan",
1111
"email": "dusan@kasan.sk",
1212
"homepage": "http://kasan.sk",
1313
"role": "Developer"
14+
},
15+
{
16+
"name": "Martin Venuš",
17+
"homepage": "https://github.com/martinvenus"
18+
},
19+
{
20+
"name": "Maciej Łebkowski",
21+
"homepage": "https://github.com/mlebkowski"
1422
}
1523
],
1624
"require-dev": {
17-
"phpspec/phpspec": "^3.4",
18-
"henrikbjorn/phpspec-code-coverage": "^3.0",
25+
"ext-dom": "*",
1926
"squizlabs/php_codesniffer": "^3.4",
2027
"phpmd/phpmd" : "^2.0",
21-
"ciaranmcnulty/phpspec-typehintedmethods": "^2.0",
22-
"phpunit/phpunit": "^5.7",
23-
"symfony/console": "^2.7"
28+
"phpspec/phpspec": "^7",
29+
"phpunit/phpunit": "^10.5"
2430
},
2531
"require": {
26-
"php": ">=5.6.0"
32+
"php": ">=8.3"
33+
},
34+
"replace": {
35+
"dusank/knapsack": "self.version"
2736
},
2837
"autoload": {
2938
"files": [

‎composer.lock

+2,705-838
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎phpspec.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
extensions:
2-
Cjm\PhpSpec\Extension\TypeHintedMethodsExtension: ~
3-
41
suites:
52
default:
63
spec_path: tests

‎phpunit.xml.dist

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit bootstrap="vendor/autoload.php">
1+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
3+
bootstrap="vendor/autoload.php"
4+
cacheResultFile=".phpunit.cache/test-results"
5+
executionOrder="depends,defects"
6+
beStrictAboutOutputDuringTests="true"
7+
failOnRisky="true"
8+
failOnWarning="true"
9+
displayDetailsOnTestsThatTriggerDeprecations="true"
10+
>
411
<testsuites>
5-
<testsuite>
12+
<testsuite name="Default">
613
<directory>tests/scenarios</directory>
714
</testsuite>
815
</testsuites>

‎tests/performance/map_vs_array_map.php

-239
This file was deleted.

‎tests/performance/reduce_vs_array_reduce.php

-220
This file was deleted.

‎tests/scenarios/CallableFuctionNamesTest.php ‎tests/scenarios/CallableFunctionNamesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace DusanKasan\Knapsack\Tests\Scenarios;
44

55
use DusanKasan\Knapsack\Collection;
6-
use PHPUnit_Framework_TestCase;
6+
use PHPUnit\Framework\TestCase;
77

8-
class CallableFunctionNamesTest extends PHPUnit_Framework_TestCase
8+
class CallableFunctionNamesTest extends TestCase
99
{
1010
/**
1111
* Example that it's possible to use callable function names as arguments.

‎tests/scenarios/CustomPassthroughFunctionTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace DusanKasan\Knapsack\Tests\Scenarios;
44

55
use DusanKasan\Knapsack\Collection;
6-
use PHPUnit_Framework_TestCase;
6+
use PHPUnit\Framework\TestCase;
77

8-
class CustomPassthroughFunctionTest extends PHPUnit_Framework_TestCase
8+
class CustomPassthroughFunctionTest extends TestCase
99
{
1010
/**
1111
* Example of implementing a transpose function and how to apply it over a collection.

‎tests/scenarios/FibonaccisSequenceTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace DusanKasan\Knapsack\Tests\Scenarios;
44

55
use DusanKasan\Knapsack\Collection;
6-
use PHPUnit_Framework_TestCase;
6+
use PHPUnit\Framework\TestCase;
77

8-
class FibonaccisSequenceTest extends PHPUnit_Framework_TestCase
8+
class FibonaccisSequenceTest extends TestCase
99
{
1010
/**
1111
* Example generating first 5 values in fibonacci's sequence.

‎tests/scenarios/GroupingFlightsTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
namespace DusanKasan\Knapsack\Tests\Scenarios;
44

55
use DusanKasan\Knapsack\Collection;
6-
use PHPUnit_Framework_TestCase;
6+
use PHPUnit\Framework\TestCase;
77

88
/**
99
* More advanced usage of collection pipeline, see
1010
* http://martinfowler.com/articles/refactoring-pipelines.html#GroupingFlightRecords for reference.
1111
*/
12-
class GroupingFlightsTest extends PHPUnit_Framework_TestCase
12+
class GroupingFlightsTest extends TestCase
1313
{
1414
private $inputData = [
1515
[

‎tests/scenarios/MultipleOperationsTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace DusanKasan\Knapsack\Tests\Scenarios;
44

55
use DusanKasan\Knapsack\Collection;
6-
use PHPUnit_Framework_TestCase;
6+
use PHPUnit\Framework\TestCase;
77

8-
class MultipleOperationsTest extends PHPUnit_Framework_TestCase
8+
class MultipleOperationsTest extends TestCase
99
{
1010
/**
1111
* Example of a longer pipeline. If this was real code, you should probably split it into smaller chunks.
@@ -29,7 +29,7 @@ public function testIt()
2929
})
3030
->flatten()
3131
->sort(function ($a, $b) {
32-
return $a > $b;
32+
return $a - $b;
3333
})
3434
->slice(2, 5)
3535
->groupBy(function ($v) {

‎tests/spec/CollectionSpec.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function it_can_group_by_key()
336336

337337
function it_can_execute_callback_for_each_item(DOMXPath $a)
338338
{
339-
$a->query('asd')->shouldBeCalled();
339+
$a->query('asd')->shouldBeCalled()->willReturn(false);
340340
$this->beConstructedWith([$a]);
341341

342342
$this

0 commit comments

Comments
 (0)
Please sign in to comment.