Skip to content

Commit

Permalink
Merge pull request #122 from ryanadair/master
Browse files Browse the repository at this point in the history
Update to php 8 and 8.1.
  • Loading branch information
bakura10 authored Mar 29, 2022
2 parents 17c1fdb + a19c50e commit fb845b2
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 18 deletions.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
}
],
"require": {
"php": "~7.0",
"php": "^7.0|^8.0|^8.1",
"guzzlehttp/guzzle-services": "^1.0",
"psr/container": "^1.0",
"psr/http-message": "^1.0",
"laminas/laminas-diactoros": "^1.3 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "^2.5"
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^2.5",
"phpspec/prophecy-phpunit": "^2.0"
},
"suggest": {
"laminas/laminas-servicemanager": "^3.0"
Expand Down
18 changes: 9 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0"?>
<phpunit bootstrap="./vendor/autoload.php" colors="true">
<testsuite name="ZfrShopify tests">
<directory>./test</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuite name="ZfrShopify tests">
<directory>./test</directory>
</testsuite>
</phpunit>
5 changes: 4 additions & 1 deletion test/Container/ShopifyClientFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@

namespace ZfrShopifyTest\Container;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Container\ContainerInterface;
use ZfrShopify\Exception\RuntimeException;
use ZfrShopify\Container\ShopifyClientFactory;
use PHPUnit\Framework\TestCase;

/**
* @author Michaël Gallego
*/
class ShopifyClientFactoryTest extends TestCase
{
use ProphecyTrait;

public function testThrowExceptionIfNoConfig()
{
$this->expectException(RuntimeException::class);
Expand Down
3 changes: 3 additions & 0 deletions test/Container/ShopifyGraphQLClientFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
use ZfrShopify\Exception\RuntimeException;
use ZfrShopify\Container\ShopifyGraphQLClientFactory;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
* @author Michaël Gallego
*/
class ShopifyGraphQLClientFactoryTest extends TestCase
{
use ProphecyTrait;

public function testThrowExceptionIfNoConfig()
{
$this->expectException(RuntimeException::class);
Expand Down
12 changes: 7 additions & 5 deletions test/OAuth/AuthorizationRedirectResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@

use ZfrShopify\OAuth\AuthorizationRedirectResponse;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
* @author Michaël Gallego
*/
class AuthorizationRedirectResponseTest extends TestCase
{
use ProphecyTrait;
public function shopDomainProvider()
{
return [
Expand All @@ -44,10 +46,10 @@ public function testCanCreateAuthorizationReponse($shop)
$location = $response->getHeaderLine('Location');

$this->assertEquals(302, $response->getStatusCode());
$this->assertContains('https://mystore.myshopify.com/admin/oauth/authorize', $location);
$this->assertContains('client_id=app_123', $location);
$this->assertContains('scope=read_content,write_content', $location);
$this->assertContains('redirect_uri=https://www.mysite.com', $location);
$this->assertContains('state=', $location);
$this->assertStringContainsString('https://mystore.myshopify.com/admin/oauth/authorize', $location);
$this->assertStringContainsString('client_id=app_123', $location);
$this->assertStringContainsString('scope=read_content,write_content', $location);
$this->assertStringContainsString('redirect_uri=https://www.mysite.com', $location);
$this->assertStringContainsString('state=', $location);
}
}
3 changes: 3 additions & 0 deletions test/OAuth/TokenExchangerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
use ZfrShopify\Exception\RuntimeException;
use ZfrShopify\OAuth\TokenExchanger;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
* @author Michaël Gallego
*/
class TokenExchangerTest extends TestCase
{
use ProphecyTrait;

public function shopDomainProvider()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions test/ShopifyClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@
use ZfrShopify\Exception\RuntimeException;
use ZfrShopify\ShopifyClient;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

/**
* @author Michaël Gallego
*/
class ShopifyClientTest extends TestCase
{
use ProphecyTrait;

public function validationData()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions test/Validator/ApplicationProxyRequestValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

namespace ZfrShopifyTest\Validator;

use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ServerRequestInterface;
use ZfrShopify\Exception\InvalidApplicationProxyRequestException;
use ZfrShopify\Validator\ApplicationProxyRequestValidator;

class ApplicationProxyRequestValidatorTest extends \PHPUnit\Framework\TestCase
{
use ProphecyTrait;

public function testValidateSignature()
{
$sharedSecret = 'hush';
Expand Down
3 changes: 3 additions & 0 deletions test/Validator/RequestValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace ZfrShopifyTest\Validator;

use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ServerRequestInterface;
use ZfrShopify\Exception\InvalidRequestException;
use ZfrShopify\Validator\RequestValidator;
Expand All @@ -27,6 +28,8 @@
*/
class RequestValidatorTest extends \PHPUnit\Framework\TestCase
{
use ProphecyTrait;

public function shopHmacProvider()
{
$key = 'shop=mystore.myshopify.com&timestamp=123';
Expand Down
3 changes: 3 additions & 0 deletions test/Validator/WebhookValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace ZfrShopifyTest\Validator;

use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ServerRequestInterface;
use ZfrShopify\Exception\InvalidRequestException;
use ZfrShopify\Validator\WebhookValidator;
Expand All @@ -27,6 +28,8 @@
*/
class WebhookValidatorTest extends \PHPUnit\Framework\TestCase
{
use ProphecyTrait;

public function testThrowExceptionIfWebhookHeaderIsNotPresent()
{
$this->expectException(InvalidRequestException::class);
Expand Down

0 comments on commit fb845b2

Please sign in to comment.