Skip to content

Commit

Permalink
Merge pull request #7 from msmakouz/update-ci
Browse files Browse the repository at this point in the history
Removing framework, adding CI, updating readme
  • Loading branch information
butschster authored Sep 14, 2022
2 parents 71f50c1 + 9980c3b commit 221e279
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 53 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
pull_request:
push:
branches:
- master
- 2.0

name: phpunit

jobs:
phpunit:
uses: spiral/gh-actions/.github/workflows/phpunit.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2']
stability: >-
['prefer-lowest', 'prefer-stable']
17 changes: 17 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
pull_request:
push:
branches:
- master
- 2.0

name: static analysis

jobs:
psalm:
uses: spiral/gh-actions/.github/workflows/psalm.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Sentry Exception Handler for Spiral
================================
[![Latest Stable Version](https://poser.pugx.org/spiral/sentry-bridge/version)](https://packagist.org/packages/spiral/sentry-bridge)
[![Build Status](https://travis-ci.org/spiral/sentry-bridge.svg?branch=master)](https://travis-ci.org/spiral/sentry-bridge)
# Sentry Exception Handler for Spiral

[![PHP Version Require](https://poser.pugx.org/spiral/sentry-bridge/require/php)](https://packagist.org/packages/spiral/sentry-bridge)
[![Latest Stable Version](https://poser.pugx.org/spiral/sentry-bridge/v/stable)](https://packagist.org/packages/spiral/sentry-bridge)
[![phpunit](https://github.com/spiral/sentry-bridge/actions/workflows/phpunit.yml/badge.svg)](https://github.com/spiral/sentry-bridge/actions)
[![psalm](https://github.com/spiral/sentry-bridge/actions/workflows/psalm.yml/badge.svg)](https://github.com/spiral/sentry-bridge/actions)
[![Codecov](https://codecov.io/gh/spiral/sentry-bridge/branch/master/graph/badge.svg)](https://codecov.io/gh/spiral/sentry-bridge/)
[![Total Downloads](https://poser.pugx.org/spiral/sentry-bridge/downloads)](https://packagist.org/packages/spiral/sentry-bridge)
[![type-coverage](https://shepherd.dev/github/spiral/sentry-bridge/coverage.svg)](https://shepherd.dev/github/spiral/sentry-bridge)
[![psalm-level](https://shepherd.dev/github/spiral/sentry-bridge/level.svg)](https://shepherd.dev/github/spiral/sentry-bridge)

<b>[Documentation](https://spiral.dev/docs/extension-sentry)</b> | [Framework Bundle](https://github.com/spiral/framework)

## License:

MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5.5",
"mockery/mockery": "^1.5",
"spiral/framework": "3.0.x-dev",
"vimeo/psalm": "^4.27",
"psr/log": "^3.0"
},
"autoload": {
Expand Down
27 changes: 13 additions & 14 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
Expand All @@ -10,17 +11,15 @@
processIsolation="false"
stopOnFailure="false"
stopOnError="false"
>

<testsuites>
<testsuite name="Sentry Exception Handler for Spiral">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Sentry Exception Handler for Spiral">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
23 changes: 23 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="tests"/>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<UndefinedAttributeClass>
<errorLevel type="suppress">
<referencedClass name="JetBrains\PhpStorm\ExpectedValues"/>
<referencedClass name="JetBrains\PhpStorm\ArrayShape"/>
</errorLevel>
</UndefinedAttributeClass>
</issueHandlers>
</psalm>
12 changes: 6 additions & 6 deletions src/SentrySnapshotter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ public function __construct(
) {
}

public function register(\Throwable $exception): SnapshotInterface
public function register(\Throwable $e): SnapshotInterface
{
$eventId = $this->client->send($exception);
$eventId = $this->client->send($e);

$snapshot = new Snapshot(
$eventId ? (string) $eventId : $this->getID($exception),
$exception
$eventId ? (string) $eventId : $this->getID($e),
$e
);

return $snapshot;
}

protected function getID(\Throwable $exception): string
protected function getID(\Throwable $e): string
{
return \md5(\implode('|', [$exception->getMessage(), $exception->getFile(), $exception->getLine()]));
return \md5(\implode('|', [$e->getMessage(), $e->getFile(), $e->getLine()]));
}
}
9 changes: 1 addition & 8 deletions tests/Sentry/BootloaderTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?php

/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/

declare(strict_types=1);

namespace Spiral\Tests\Sentry;
Expand Down Expand Up @@ -40,7 +33,7 @@ public function testBootloader(): void
'dsn' => 'test'
]);

(new BootloadManager($c, new Initializer($c)))->bootload([SentryBootloader::class]);
(new BootloadManager($c, $c, $c, new Initializer($c, $c)))->bootload([SentryBootloader::class]);

$c->bind(SentryConfig::class, new SentryConfig([
'dsn' => 'https://[email protected]/2'
Expand Down
7 changes: 0 additions & 7 deletions tests/Sentry/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?php

/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/

declare(strict_types=1);

namespace Spiral\Tests\Sentry;
Expand Down
7 changes: 0 additions & 7 deletions tests/Sentry/SnapshotterTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?php

/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/

declare(strict_types=1);

namespace Spiral\Tests\Sentry;
Expand Down
6 changes: 0 additions & 6 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?php

/**
* Spiral Framework, SpiralScout LLC.
*
* @author Anton Titov (Wolfy-J)
*/

declare(strict_types=1);

error_reporting(E_ALL | E_STRICT);
Expand Down

0 comments on commit 221e279

Please sign in to comment.