Skip to content

Commit

Permalink
Merge pull request #6 from narendravaghela/master
Browse files Browse the repository at this point in the history
Updates for GitHub CI
  • Loading branch information
narendravaghela authored Apr 20, 2022
2 parents fe134d2 + fc886ba commit 0a72827
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ jobs:
- name: Run phpcs
run: composer cs-check

- name: Run psalm
run: psalm --output-format=github
# - name: Run psalm
# run: psalm --output-format=github
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SendGrid Plugin for CakePHP

[![CI](https://github.com/sprintcube/cakephp-sendgrid/workflows/CI/badge.svg?branch=master)](https://github.com/sprintcube/cakephp-sendgrid/actions)
[![codecov](https://codecov.io/gh/sprintcube/cakephp-sendgrid/branch/master/graph/badge.svg)](https://codecov.io/gh/sprintcube/cakephp-sendgrid)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Latest Stable Version](https://poser.pugx.org/sprintcube/cakephp-sendgrid/v/stable)](https://packagist.org/packages/sprintcube/cakephp-sendgrid)
Expand Down
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@
"@test",
"@cs-check"
],
"cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
"cs-check": "phpcs --colors -p src/ tests/TestCase/",
"cs-fix": "phpcbf --colors src/ tests/TestCase/",
"psalm": "psalm",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 vimeo/psalm:~4.1.0 && mv composer.backup composer.json",
"phpstan": "phpstan analyze --level 1 src/",
"test": "phpunit --colors=always"
},
"prefer-stable": true,
"minimum-stability": "dev"
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
7 changes: 7 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="CakePHP Core">
<rule ref="./vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml"/>

<exclude-pattern>tests/test_files/js/*</exclude-pattern>
<exclude-pattern>tests/test_files/css/*</exclude-pattern>
</ruleset>
2 changes: 2 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.13.1@afd8874a9e4562eac42a02de90e42e430c3a1db1"/>
17 changes: 17 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<psalm
errorLevel="6"
resolveFromConfigFile="true"
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"
errorBaseline="psalm-baseline.xml"
autoloader="tests/bootstrap.php"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
3 changes: 1 addition & 2 deletions src/Mailer/Exception/SendGridApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
*/
class SendGridApiException extends Exception
{

/**
* {@inheritDoc}
* @inheritDoc
*/
protected $_messageTemplate = '%s';
}
9 changes: 4 additions & 5 deletions src/Mailer/Transport/SendGridTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
*/
class SendGridTransport extends AbstractTransport
{

/**
* Default config for this class
*
* @var array
*/
protected $_defaultConfig = [
'apiEndpoint' => 'https://api.sendgrid.com/v3',
'apiKey' => ''
'apiKey' => '',
];

/**
Expand Down Expand Up @@ -183,21 +182,21 @@ protected function _prepareEmailAddresses(Message $message)
foreach ($message->getTo() as $toEmail => $toName) {
$emails['to'][] = [
'email' => $toEmail,
'name' => $toName
'name' => $toName,
];
}

foreach ($message->getCc() as $ccEmail => $ccName) {
$emails['cc'][] = [
'email' => $ccEmail,
'name' => $ccName
'name' => $ccName,
];
}

foreach ($message->getBcc() as $bccEmail => $bccName) {
$emails['bcc'][] = [
'email' => $bccEmail,
'name' => $bccName
'name' => $bccName,
];
}

Expand Down
2 changes: 0 additions & 2 deletions tests/TestCase/Mailer/Transport/SendGridTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@

namespace SendGrid\Test\TestCase\Mailer\Transport;

use Cake\Mailer\Email;
use Cake\TestSuite\TestCase;

class SendGridTransportTest extends TestCase
{

public function setUp(): void
{
parent::setUp();
Expand Down

0 comments on commit 0a72827

Please sign in to comment.