Skip to content

Commit

Permalink
Merge pull request #82 from carakas/master
Browse files Browse the repository at this point in the history
Add php 8 support to spoon library
  • Loading branch information
carakas committed Jun 8, 2021
2 parents 8b4429f + cec8fca commit 60e69d2
Show file tree
Hide file tree
Showing 22 changed files with 132 additions and 48 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.1, 7.2, 7.3, 7.4]
php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1]
testsuite: ["unit"]
name: PHPUnit - ${{ matrix.testsuite }} (PHP ${{ matrix.php }})
services:
Expand Down Expand Up @@ -40,9 +40,12 @@ jobs:
- name: Install dependencies
env:
FORK_ENV: test
SYMFONY_DEPRECATIONS_HELPER: "quiet"
run: composer install -o

- name: Execute tests
env:
SYMFONY_DEPRECATIONS_HELPER: "quiet"
run: vendor/bin/simple-phpunit --testsuite=${{ matrix.testsuite}} --coverage-clover=${{ matrix.testsuite}}.clover

- name: Upload Coverage report
Expand Down
6 changes: 3 additions & 3 deletions composer.json
@@ -1,7 +1,7 @@
{
"name": "spoon/library",
"type": "library",
"description": "A PHP5 library that is fast, easy to learn and fun!",
"description": "A PHP library that is fast, easy to learn and very much deprecated!",
"homepage": "http://www.spoon-library.com",
"license": "BSD-2-Clause",
"authors": [
Expand All @@ -11,9 +11,9 @@
}
],
"require": {
"php": "^7.1"
"php": "^7.1|^8.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.3"
"symfony/phpunit-bridge": "^5.3"
}
}
119 changes: 102 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions spoon/datagrid/datagrid.php
Expand Up @@ -1479,7 +1479,7 @@ public function setColumnConfirm($column, $message, $custom = null)
* @param mixed $columns The columns wherein the result will appear.
* @param bool[optional] $overwrite Should the result overwrite the current value?
*/
public function setColumnFunction($function, $arguments = null, $columns, $overwrite = false)
public function setColumnFunction($function, $arguments = null, $columns = null, $overwrite = false)
{
// has results
if($this->source->getNumResults() > 0)
Expand Down Expand Up @@ -1919,7 +1919,7 @@ public function setSortingColumns(array $columns, $default = null)
* @param string[optional] $desc The icon for descending.
* @param string[optional] $descSelected The icon when descending sort is applied.
*/
public function setSortingIcons($asc = null, $ascSelected = null, $desc = null, $descSelected)
public function setSortingIcons($asc = null, $ascSelected = null, $desc = null, $descSelected = null)
{
if($asc !== null) $this->sortingIcons['asc'] = (string) $asc;
if($ascSelected !== null) $this->sortingIcons['ascSelected'] = (string) $ascSelected;
Expand Down
4 changes: 1 addition & 3 deletions spoon/tests/SpoonTest.php
Expand Up @@ -16,11 +16,9 @@ public function testGet()
$this->assertEquals(Spoon::get('stored_value'), $value);
}

/**
* @expectedException SpoonException
*/
public function testGetFailure()
{
$this->expectException(SpoonException::class);
$this->assertEquals('I have no idea what I am doing.', Spoon::get('my_custom_value'));
}

Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/database/SpoonDatabaseLargeDataSet.php
Expand Up @@ -33,7 +33,7 @@ class SpoonDatabaseLargeDataSet extends TestCase
/**
*
*/
public function setup()
public function setup(): void
{
$this->db = new SpoonDatabase('mysql', '127.0.0.1', 'root', 'spoon', 'spoon_tests');
}
Expand Down
6 changes: 3 additions & 3 deletions spoon/tests/database/SpoonDatabaseTest.php
Expand Up @@ -14,7 +14,7 @@ class SpoonDatabaseTest extends TestCase
*/
protected $db;

public function setup()
public function setup(): void
{
// create database object
$this->db = new SpoonDatabase('mysql', '127.0.0.1', 'root', 'spoon', 'spoon_tests');
Expand Down Expand Up @@ -284,8 +284,8 @@ public function testUpdateDate()
*/
public function testOptimize()
{
self::assertArraySubset([], $this->db->optimize('users'));
self::assertArraySubset([], $this->db->optimize(array('users')));
self::assertIsArray($this->db->optimize('users'));
self::assertIsArray($this->db->optimize(array('users')));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/directory/SpoonDirectoryTest.php
Expand Up @@ -11,7 +11,7 @@ class SpoonDirectoryTest extends TestCase
{
protected $path;

protected function setUp()
protected function setup(): void
{
// set path
$this->path = dirname(dirname(__FILE__)) . '/tmp';
Expand Down
6 changes: 2 additions & 4 deletions spoon/tests/file/SpoonFileTest.php
Expand Up @@ -9,7 +9,7 @@

class SpoonFileTest extends TestCase
{
public function setup()
public function setup(): void
{
if(!defined('TMPPATH')) define('TMPPATH', dirname(realpath(dirname(__FILE__))) . '/tmp');

Expand All @@ -27,11 +27,9 @@ public function testDownload()
$this->assertFalse(SpoonFile::download($this->existingUrl, $this->destinationFile, false));
}

/**
* @expectedException SpoonFileException
*/
public function testDownloadFailure()
{
$this->expectException(SpoonFileException::class);
SpoonFile::download($this->nonExistingUrl, $this->destinationFile);
}
}
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFileFieldTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFileFieldTest extends TestCase
*/
protected $filePDF;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('filefield');
$this->filePDF = new SpoonFormFile('pdf');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormButtonTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormButtonTest extends TestCase
*/
protected $frm;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('button');
$this->btnSubmit = new SpoonFormButton('submit', 'Submit', 'submit');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormCheckboxTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormCheckboxTest extends TestCase
*/
protected $chkAgree;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('checkbox');
$this->chkAgree = new SpoonFormCheckbox('agree', true);
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormDateTest.php
Expand Up @@ -21,7 +21,7 @@ class SpoonFormDateTest extends TestCase
*/
protected $txtDate;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('datefield');
$this->txtDate = new SpoonFormDate('date', strtotime('Last Monday'), 'd/m/Y');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormDropdownTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormDropdownTest extends TestCase
*/
protected $ddmSingle, $ddmMultiple, $ddmOptGroupSingle, $ddmOptGroupMultiple, $ddmDefaultElement;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('dropdown');
$this->ddmSingle = new SpoonFormDropdown('single', array(1 => 'Davy Hellemans', 'Tys Verkoyen', 'Dave Lens'));
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormHiddenTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormHiddenTest extends TestCase
*/
protected $hidHidden;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('hiddenfield');
$this->hidHidden = new SpoonFormHidden('hidden', 'I am the default value');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormMultiCheckBoxTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormMultiCheckBoxTest extends TestCase
*/
protected $chkHobbies;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('multicheckbox');
$hobbies[] = array('label' => 'Swimming', 'value' => 10);
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormPasswordTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormPasswordTest extends TestCase
*/
protected $txtPassword;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('passwordfield');
$this->txtPassword = new SpoonFormPassword('name', 'I am the default value');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormRadiobuttonTest.php
Expand Up @@ -24,7 +24,7 @@ class SpoonFormRadiobuttonTest extends TestCase
*/
protected $rbtNumeric;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('radiobutton');
$gender[] = array('label' => 'Female', 'value' => 'F');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormTextTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormTextTest extends TestCase
*/
protected $txtName;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('textfield');
$this->txtName = new SpoonFormText('name', 'I am the default value');
Expand Down
2 changes: 1 addition & 1 deletion spoon/tests/form/SpoonFormTextareaTest.php
Expand Up @@ -19,7 +19,7 @@ class SpoonFormTextareaTest extends TestCase
*/
protected $txtMessage;

public function setup()
public function setup(): void
{
$this->frm = new SpoonForm('textarea');
$this->txtMessage = new SpoonFormTextarea('message', 'I am the default value');
Expand Down

0 comments on commit 60e69d2

Please sign in to comment.