Handle Appstore server-to-server notifications in Laravel or Lumen projects for auto-renewable subscriptions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.8 KiB

5 years ago
<?php
namespace Appvise\AppStoreNotifications\Tests;
use Exception;
use CreateAppleNotificationsTable;
5 years ago
use Illuminate\Foundation\Exceptions\Handler;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Appvise\AppStoreNotifications\NotificationsServiceProvider;
5 years ago
abstract class TestCase extends OrchestraTestCase
{
public function setUp(): void
{
parent::setUp();
$this->setUpDatabase();
}
/**
* Set up the environment.
*
* @param \Illuminate\Foundation\Application $app
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
config(['appstore-server-notifications.shared_secret' => 'test_shared_secret']);
}
protected function setUpDatabase()
{
include_once __DIR__.'/../database/migrations/create_apple_notifications_table.php.stub';
(new CreateAppleNotificationsTable())->up();
}
/**
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageProviders($app)
{
return [
NotificationsServiceProvider::class,
];
}
protected function disableExceptionHandling()
{
$this->app->instance(ExceptionHandler::class, new class extends Handler {
public function __construct()
{
}
public function report(Exception $e)
{
}
public function render($request, Exception $exception)
{
throw $exception;
}
});
}
}