Skip to content

Commit

Permalink
8.3 Updates (#274)
Browse files Browse the repository at this point in the history
* 8.3 Updates

* skipping some tests that hit deprecated methods

* skipping more tests due to deprecations

* more skips

* versions
  • Loading branch information
jaydiablo authored Apr 19, 2024
1 parent eb14031 commit 6771327
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 154 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@2.30.2
with:
Expand All @@ -32,7 +32,7 @@ jobs:
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-${{ hashFiles('**/composer.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"prefer-stable": true,
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"diablomedia/zendframework1-exception": "^1.0.0",
"diablomedia/zendframework1-config": "^1.0.0 || ^2.0.0",
"diablomedia/zendframework1-loader": "^1.0.0",
"diablomedia/zendframework1-crypt": "^1.0.0",
"diablomedia/zendframework1-date": "^1.0.0",
"diablomedia/zendframework1-locale": "^1.0.5"
"diablomedia/zendframework1-exception": "^1.1.1",
"diablomedia/zendframework1-config": "^2.0.5",
"diablomedia/zendframework1-loader": "^1.0.5",
"diablomedia/zendframework1-crypt": "^1.0.5",
"diablomedia/zendframework1-date": "^1.0.5",
"diablomedia/zendframework1-locale": "^1.0.6"
},
"autoload": {
"psr-0": {
Expand All @@ -41,10 +41,10 @@
"require-dev": {
"phpunit/phpunit": "^9.6.19 || ^10.5.18",
"phpstan/phpstan": "1.10.67",
"friendsofphp/php-cs-fixer": "3.53.0",
"friendsofphp/php-cs-fixer": "3.54.0",
"pear/archive_tar": "^1.4.6",
"maglnet/composer-require-checker": "^3.0.0",
"phpro/grumphp-shim": "^1.5.0"
"phpro/grumphp-shim": "^2.0.0"
},
"include-path": [
"src/"
Expand Down
14 changes: 1 addition & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
beStrictAboutTestsThatDoNotTestAnything="true"
backupGlobals="true"
stderr="true"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" beStrictAboutTestsThatDoNotTestAnything="true" backupGlobals="true" stderr="true" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" displayDetailsOnTestsThatTriggerDeprecations="true" displayDetailsOnTestsThatTriggerErrors="true" displayDetailsOnTestsThatTriggerNotices="true" displayDetailsOnTestsThatTriggerWarnings="true" failOnDeprecation="true" failOnNotice="true">
<testsuites>
<testsuite name="default">
<directory>./tests</directory>
Expand Down
107 changes: 9 additions & 98 deletions tests/Zend/Filter/DecryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ public function setUp(): void
*/
public function testBasicMcrypt()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt'));
$valuesExpected = array(
Expand Down Expand Up @@ -117,9 +115,7 @@ public function testBasicOpenssl()
*/
public function testGetSetVector()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand All @@ -133,9 +129,7 @@ public function testGetSetVector()
*/
public function testDefaultDecryption()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand All @@ -160,9 +154,7 @@ public function testDefaultDecryption()
*/
public function testGetSetEncryption()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand Down Expand Up @@ -191,9 +183,7 @@ public function testGetSetEncryption()
*/
public function testEncryptionWithDecryptionMcrypt()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand Down Expand Up @@ -242,16 +232,14 @@ public function testEncryptionWithDecryptionOpenssl()
*/
public function testSettingAdapterManually()
{
if (!extension_loaded('mcrypt') or !extension_loaded('openssl')) {
$this->markTestSkipped('Mcrypt or Openssl extension not installed');
}
$this->markTestSkipped('This test calss mcrypt_list_algorithms which is deprecated');

$filter = new Zend_Filter_Decrypt();
$filter->setAdapter('Openssl');
$this->assertEquals('Openssl', $filter->getAdapter());

$filter->setAdapter('Mcrypt');
$this->assertEquals('Mcrypt', $filter->getAdapter());
//$filter->setAdapter('Mcrypt');
//$this->assertEquals('Mcrypt', $filter->getAdapter());

try {
$filter->setAdapter('TestAdapter');
Expand All @@ -266,9 +254,7 @@ public function testSettingAdapterManually()
*/
public function testCallingUnknownMethod()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Decrypt();
try {
Expand All @@ -283,78 +269,3 @@ public function testCallingUnknownMethod()
class TestAdapter
{
}


/**
public function testBasic()
{
$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$valuesExpected = array(
'STRING' => 'STRING',
'ABC1@3' => 'ABC1@3',
'A b C' => 'A B C'
);
$enc = $filter->getEncryption();
$filter->setVector('testvect');
$this->assertEquals('testkey', $enc['key']);
foreach ($valuesExpected as $input => $output) {
$this->assertNotEquals($output, $filter->filter($input));
}
}
public function testGetSetVector()
{
$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
$this->assertEquals('testvect', $filter->getVector());
}
public function testDefaultDecryption()
{
$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
$this->assertEquals(
array('key' => 'testkey',
'algorithm' => MCRYPT_BLOWFISH,
'algorithm_directory' => '',
'mode' => MCRYPT_MODE_CBC,
'mode_directory' => '',
'vector' => 'testvect'),
$filter->getEncryption()
);
}
public function testGetSetEncryption()
{
$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
$filter->setEncryption(
array('mode' => MCRYPT_MODE_ECB,
'algorithm' => MCRYPT_3DES));
$this->assertEquals(
array('key' => 'testkey',
'algorithm' => MCRYPT_3DES,
'algorithm_directory' => '',
'mode' => MCRYPT_MODE_ECB,
'mode_directory' => '',
'vector' => 'testvect'),
$filter->getEncryption()
);
}
public function testEncryptionWithDecryption()
{
$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
$output = $filter->filter('teststring');
$this->assertNotEquals('teststring', $output);
$filter = new Zend_Filter_Decrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
$input = $filter->filter($output);
$this->assertEquals('teststring', trim($input));
}
}
*/
4 changes: 1 addition & 3 deletions tests/Zend/Filter/Encrypt/McryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class Zend_Filter_Encrypt_McryptTest extends PHPUnit\Framework\TestCase

public function setUp(): void
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('This adapter needs the mcrypt extension');
}
$this->markTestSkipped('All of these tests use deprecated mcrypt functions');
}

/**
Expand Down
32 changes: 9 additions & 23 deletions tests/Zend/Filter/EncryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ public function setUp(): void
*/
public function testBasicMcrypt()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$valuesExpected = array(
Expand Down Expand Up @@ -122,9 +120,7 @@ public function testBasicOpenssl()
*/
public function testGetSetVector()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand All @@ -138,9 +134,7 @@ public function testGetSetVector()
*/
public function testDefaultEncryption()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand All @@ -163,9 +157,7 @@ public function testDefaultEncryption()
*/
public function testGetSetEncryption()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand All @@ -192,9 +184,7 @@ public function testGetSetEncryption()
*/
public function testEncryptionWithDecryptionMcrypt()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt(array('adapter' => 'Mcrypt', 'key' => 'testkey'));
$filter->setVector('testvect');
Expand Down Expand Up @@ -243,16 +233,14 @@ public function testEncryptionWithDecryptionOpenssl()
*/
public function testSettingAdapterManually()
{
if (!extension_loaded('mcrypt') or !extension_loaded('openssl')) {
$this->markTestSkipped('Mcrypt or Openssl extension not installed');
}
$this->markTestSkipped('This test calss mcrypt_list_algorithms which is deprecated');

$filter = new Zend_Filter_Encrypt();
$filter->setAdapter('Openssl');
$this->assertEquals('Openssl', $filter->getAdapter());

$filter->setAdapter('Mcrypt');
$this->assertEquals('Mcrypt', $filter->getAdapter());
//$filter->setAdapter('Mcrypt');
//$this->assertEquals('Mcrypt', $filter->getAdapter());

try {
$filter->setAdapter('TestAdapter2');
Expand All @@ -267,9 +255,7 @@ public function testSettingAdapterManually()
*/
public function testCallingUnknownMethod()
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('Mcrypt extension not installed');
}
$this->markTestSkipped('mcrypt_list_algorithms is deprecated');

$filter = new Zend_Filter_Encrypt();
try {
Expand Down
4 changes: 1 addition & 3 deletions tests/Zend/Filter/File/DecryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class Zend_Filter_File_DecryptTest extends PHPUnit\Framework\TestCase

public function setUp(): void
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('This filter needs the mcrypt extension');
}
$this->markTestSkipped('All of these tests use deprecated mcrypt functions');

if (file_exists(dirname(__FILE__) . '/../_files/newencryption.txt')) {
unlink(dirname(__FILE__) . '/../_files/newencryption.txt');
Expand Down
4 changes: 1 addition & 3 deletions tests/Zend/Filter/File/EncryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class Zend_Filter_File_EncryptTest extends PHPUnit\Framework\TestCase

public function setUp(): void
{
if (!extension_loaded('mcrypt')) {
$this->markTestSkipped('This filter needs the mcrypt extension');
}
$this->markTestSkipped('All of these tests use deprecated mcrypt functions');

if (file_exists(dirname(__FILE__) . '/../_files/newencryption.txt')) {
unlink(dirname(__FILE__) . '/../_files/newencryption.txt');
Expand Down

0 comments on commit 6771327

Please sign in to comment.