Skip to content

Commit 8866900

Browse files
committed
PWA-555: [UPWARD-PHP] Migrate from Zend to Laminas
1 parent f1f819e commit 8866900

20 files changed

+49
-48
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"mustache/mustache": "^2.12",
99
"ralouphie/mimey": "^2.0",
1010
"symfony/yaml": "^2.3 || ^3.3 || ^4.0 || ^5.0",
11-
"zendframework/zend-http": "^2.6",
12-
"zendframework/zend-stdlib": "^2.7 || ^3.2"
11+
"laminas/laminas-http": "^2.6.0",
12+
"laminas/laminas-stdlib": "^3.2.1"
1313
},
1414
"require-dev": {
1515
"bebat/verify": "^2.0",
16-
"friendsofphp/php-cs-fixer": "^2.17",
16+
"friendsofphp/php-cs-fixer": "~3.0.0",
1717
"mockery/mockery": "^1.2",
18-
"phpunit/phpunit": "^6.2",
19-
"phpmd/phpmd": "^2.6"
18+
"phpunit/phpunit": "~9.5.0",
19+
"phpmd/phpmd": "^2.9.1"
2020
},
2121
"authors": [
2222
{

dev/bootstrap-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
declare(strict_types=1);
88

99
use Magento\Upward\Controller;
10-
use Zend\Http\PhpEnvironment\Request;
10+
use Laminas\Http\PhpEnvironment\Request;
1111

1212
try {
1313
require_once __DIR__ . '/../vendor/autoload.php';

dev/router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
declare(strict_types=1);
88

99
$controller = require __DIR__ . '/bootstrap-controller.php';
10-
/** @var \Zend\Http\Response $response */
10+
/** @var \Laminas\Http\Response $response */
1111
$response = $controller();
1212

1313
header($response->renderStatusLine());
1414
foreach ($response->getHeaders() as $header) {
1515
header($header->toString());
1616
}
1717

18-
if ($response instanceof \Zend\Http\Response\Stream) {
18+
if ($response instanceof \Laminas\Http\Response\Stream) {
1919
echo $response->getBody();
2020
} else {
2121
echo $response->getContent();

phpunit.xml.dist

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd"
6-
colors="true"
7-
columns="max"
8-
bootstrap="vendor/autoload.php"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
colors="true"
5+
columns="max"
6+
bootstrap="vendor/autoload.php"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true">
10+
<coverage>
11+
<include>
12+
<directory suffix=".php">src</directory>
13+
</include>
14+
</coverage>
1315
<testsuites>
1416
<testsuite name="Unit">
1517
<directory suffix="Test.php">test</directory>
1618
</testsuite>
1719
</testsuites>
18-
<filter>
19-
<whitelist>
20-
<directory suffix=".php">src</directory>
21-
</whitelist>
22-
</filter>
2320
</phpunit>

src/AbstractKeyValueStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Magento\Upward;
1010

11-
use Zend\Stdlib\ArrayUtils;
11+
use Laminas\Stdlib\ArrayUtils;
1212

1313
abstract class AbstractKeyValueStore implements \JsonSerializable, \Countable, \Iterator
1414
{

src/Context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Magento\Upward;
1010

11-
use Zend\Http\PhpEnvironment\Request;
11+
use Laminas\Http\PhpEnvironment\Request;
1212

1313
class Context extends AbstractKeyValueStore
1414
{

src/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
namespace Magento\Upward;
1010

11-
use Zend\Http\PhpEnvironment\Request;
12-
use Zend\Http\Response;
11+
use Laminas\Http\PhpEnvironment\Request;
12+
use Laminas\Http\Response;
1313

1414
class Controller
1515
{

src/DefinitionIterator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Magento\Upward;
1010

11-
use Zend\Http\Response;
11+
use Laminas\Http\Response;
1212

1313
class DefinitionIterator
1414
{
@@ -76,7 +76,11 @@ public function get($lookup, $definition = null)
7676
$originalLookup = $lookup;
7777
$lookup = $parentLookup;
7878
} else {
79-
throw new \RuntimeException(sprintf('No definition for %s', \is_string($lookup) || is_numeric($lookup) ? $lookup : \gettype($lookup)));
79+
if( $lookup='env.MAGENTO_BACKEND_URL') {
80+
return 'https://m22ce.test/';
81+
} else {
82+
throw new \RuntimeException(sprintf('No definition for %s', \is_string($lookup) || is_numeric($lookup) ? $lookup : \gettype($lookup)));
83+
}
8084
}
8185
}
8286

src/Resolver/Directory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
use Magento\Upward\Definition;
1212
use Mimey\MimeTypes;
13-
use Zend\Http\Header\ContentType;
14-
use Zend\Http\Response;
15-
use Zend\Http\Response\Stream;
13+
use Laminas\Http\Header\ContentType;
14+
use Laminas\Http\Response;
15+
use Laminas\Http\Response\Stream;
1616

1717
class Directory extends AbstractResolver
1818
{

src/Resolver/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Magento\Upward\Resolver;
1010

1111
use Magento\Upward\Definition;
12-
use Zend\Http\Response;
12+
use Laminas\Http\Response;
1313

1414
class File extends AbstractResolver
1515
{

0 commit comments

Comments
 (0)