Skip to content

Commit

Permalink
Merge branch 'develop' into phpstan-l1
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Jul 13, 2024
2 parents 5acefc9 + 559dcd3 commit 55d6124
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Test OpenMage 20.9.x
name: Test OpenMage 20.10.x

on: [push, pull_request]

Expand All @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
openmage_version: ["20.9.0"]
openmage_version: ["20.10.0"]
php_version: ["8.3", "8.2", "8.1", "7.4"]
mysql_version: ["8.0", "5.7"]

Expand Down Expand Up @@ -80,9 +80,6 @@ jobs:
env:
COMPOSER_VENDOR_PATH : "${{ github.workspace }}/magento/vendor"

# Temporary allow tests to fail until code in OpenMage is fixed
continue-on-error: true

- name: Report coverage
uses: codecov/codecov-action@v4
with:
Expand All @@ -91,8 +88,6 @@ jobs:
- name: Run functional tests
run: bats tests/bats/functional.bats
env:
COMPOSER_VENDOR_PATH : "${{ github.workspace }}/magento/vendor"
N98_MAGERUN_BIN: "${{ github.workspace }}/bin/n98-magerun"
N98_MAGERUN_TEST_MAGENTO_ROOT: "${{ github.workspace }}/magento"

# Temporary allow tests to fail until code in OpenMage is fixed
continue-on-error: true
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"symfony/console": "~5.4",
"symfony/event-dispatcher": "~5.4",
"symfony/finder": "~5.4",
"symfony/polyfill-php80": "^1.30",
"symfony/process": "~5.4",
"symfony/validator": "~5.4",
"symfony/yaml": "~5.4",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

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

5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ commands:

N98\Magento\Command\Installer\InstallCommand:
magento-packages:
- name: openmage-20.10.0
package: openmage/magento-lts
version: 20.10.0
extra:
sample-data: sample-data-1.9.2.4
- name: openmage-20.9.0
package: openmage/magento-lts
version: 20.9.0
Expand Down
8 changes: 8 additions & 0 deletions src/N98/Magento/Command/Eav/Attribute/RemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
} else {
$setup->removeAttribute($entityType, $attributeCode);

// required with EAV attribute caching added in OpenMage 20.1.0
if (method_exists('Mage', 'getOpenMageVersion')
&& version_compare(Mage::getOpenMageVersion(), '20.1', '>=')
) {
Mage::app()->getCacheInstance()->cleanType('eav');
Mage::dispatchEvent('adminhtml_cache_refresh_type', ['type' => 'eav']);
}

$output->writeln(
sprintf(
'<info>Successfully removed attribute: "%s" from entity type: "%s"</info>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace N98\Magento\Command\Installer\SubCommand;

use N98\Magento\Command\SubCommand\AbstractSubCommand;
use N98\Util\BinaryString;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -42,7 +41,7 @@ public function execute()
$dbOptionsFound = 0;
foreach ($dbOptions as $dbOption) {
foreach ($this->getCliArguments() as $definedCliOption) {
if (BinaryString::startsWith($definedCliOption, $dbOption)) {
if (str_starts_with($definedCliOption, $dbOption)) {
$dbOptionsFound++;
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/N98/Util/BinaryString.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,26 @@ public static function trimExplodeEmpty($delimiter, $string)
* @param string $needle
*
* @return bool
*
* @deprecated use str_starts_with() instead
*/
public static function startsWith($haystack, $needle)
{
return $needle === '' || strpos($haystack, $needle) === 0;
trigger_error(__METHOD__ . ' is obsolete, use str_starts_with', E_USER_DEPRECATED);
return str_starts_with($haystack, $needle);
}

/**
* @param string $haystack
* @param string $needle
*
* @return bool
*
* @deprecated use str_ends_with() instead
*/
public static function endsWith($haystack, $needle)
{
return $needle === '' || substr($haystack, -strlen($needle)) === $needle;
trigger_error(__METHOD__ . ' is obsolete, use str_ends_with()', E_USER_DEPRECATED);
return str_ends_with($haystack, $needle);
}
}
3 changes: 1 addition & 2 deletions src/N98/Util/Console/Helper/ComposerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace N98\Util\Console\Helper;

use N98\Util\BinaryString;
use N98\Util\OperatingSystem;
use Symfony\Component\Console\Helper\Helper as AbstractHelper;
use Symfony\Component\Console\Input\InputAwareInterface;
Expand Down Expand Up @@ -72,7 +71,7 @@ public function getConfigValue($key, $useGlobalConfig = true)
$lines = explode(PHP_EOL, $composerOutput);

foreach ($lines as $line) {
if (BinaryString::startsWith($line, 'Changed current directory to')) {
if (str_starts_with($line, 'Changed current directory to')) {
continue;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/N98/Magento/Command/Eav/Attribute/RemoveCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ protected function createAttribute($entityType, $attributeCode, $data)
{
$setup = Mage::getModel('eav/entity_setup', 'core_setup');
$setup->addAttribute($entityType, $attributeCode, $data);

// required with EAV attribute caching added in OpenMage 20.1.0
if (method_exists('Mage', 'getOpenMageVersion')
&& version_compare(Mage::getOpenMageVersion(), '20.1', '>=')
) {
Mage::app()->getCacheInstance()->cleanType('eav');
}
}

/**
Expand Down
20 changes: 0 additions & 20 deletions tests/N98/Util/BinaryStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,4 @@ public function trimExplodeEmptyProvider()
{
return [[',', 'Foo,Bar', ['Foo', 'Bar']], ['#', ' Foo# Bar', ['Foo', 'Bar']], [',', ',,Foo, Bar,,', ['Foo', 'Bar']]];
}

/**
* @test
*/
public function startsWith()
{
self::assertTrue(BinaryString::startsWith('Foo', 'Foo'));
self::assertTrue(BinaryString::startsWith('Foo123', 'Foo'));
self::assertFalse(BinaryString::startsWith(' Foo123', 'Foo'));
}

/**
* @test
*/
public function endsWith()
{
self::assertTrue(BinaryString::endsWith('Foo', 'Foo'));
self::assertTrue(BinaryString::endsWith('Foo123', '123'));
self::assertFalse(BinaryString::endsWith(' Foo123 ', '123'));
}
}

0 comments on commit 55d6124

Please sign in to comment.