Skip to content

Commit f63f220

Browse files
authored
Sustituir Codeception por PhpUnit (#3)
1 parent 3aee08a commit f63f220

9 files changed

Lines changed: 23 additions & 34 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,17 @@ on: push
44

55
jobs:
66
build:
7-
runs-on: ubuntu-20.04
8-
strategy:
9-
matrix:
10-
php: [ 7.4, 8.0 ]
7+
runs-on: ubuntu-24.04
118
steps:
129
- name: Install PHP
1310
uses: shivammathur/setup-php@v2
1411
with:
15-
php-version: ${{ matrix.php }}
12+
php-version: 8.4
1613

17-
- uses: actions/checkout@v2
18-
with:
19-
fetch-depth: 1
14+
- uses: actions/checkout@v7
2015

2116
- name: Install dependencies
2217
run: composer install --prefer-dist --no-progress --no-suggest
2318

2419
- name: Run tests
25-
run: vendor/bin/codecept run
20+
run: vendor/bin/phpunit --testdox tests

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor/
22
.idea
33
composer.lock
4+
.phpunit.result.cache

‎codeception.yml‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎composer.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
"name": "biller/csv2array",
33
"type": "library",
44
"require": {
5-
"php": "^7.0 || ^8.0",
5+
"php": "^8.4",
66
"league/csv": "^9.0"
77
},
88
"require-dev": {
9-
"codeception/codeception": "^4.1",
10-
"codeception/module-asserts": "^1.0.0"
9+
"phpunit/phpunit": "^12.5"
1110
},
1211
"license": "MIT",
1312
"authors": [

‎phpunit.xml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
colors="true">
4+
<testsuites>
5+
<testsuite name="unit">
6+
<directory>tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
</phpunit>

‎src/Csv2Array.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Csv2Array
88
{
99
public static function convert(string $file, bool $headers = true)
1010
{
11-
$csv = Reader::createFromPath($file);
11+
$csv = Reader::from($file);
1212
if ($headers) {
1313
$csv->setHeaderOffset(0);
1414
}
@@ -26,4 +26,4 @@ public static function convert(string $file, bool $headers = true)
2626

2727
return $return;
2828
}
29-
}
29+
}

‎tests/Csv2ArrayTest.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
use biller\csv2array\Csv2Array;
4-
use Codeception\Test\Unit;
4+
use PHPUnit\Framework\TestCase;
55

6-
class Csv2ArrayTest extends Unit
6+
class Csv2ArrayTest extends TestCase
77
{
88
public function testHeaders()
99
{
10-
$file = codecept_data_dir('names.csv');
10+
$file = __DIR__ . '/_data/names.csv';
1111
$array = Csv2Array::convert($file);
1212
$this->assertEquals([
1313
['name' => 'Peter'],
@@ -18,12 +18,12 @@ public function testHeaders()
1818

1919
public function testNoHeaders()
2020
{
21-
$file = codecept_data_dir('numbers.csv');
21+
$file = __DIR__ . '/_data/numbers.csv';
2222
$array = Csv2Array::convert($file, false);
2323
$this->assertEquals([
2424
['123', '456'],
2525
['456'],
2626
['789'],
2727
], $array);
2828
}
29-
}
29+
}

‎tests/_output/.gitignore‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎tests/_support/.gitkeep‎

Whitespace-only changes.

0 commit comments

Comments
 (0)