Skip to content

Commit

Permalink
Merge pull request #3 from Mane-Olawale/development
Browse files Browse the repository at this point in the history
Token Feature and Complete tests
  • Loading branch information
Mane-Olawale authored Feb 14, 2022
2 parents 603e618 + 0ad2b53 commit 424c8d1
Show file tree
Hide file tree
Showing 24 changed files with 827 additions and 229 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us fix the problem
title: '[BUG]'
labels: ''
assignees: Mane-Olawale

---

- PHP Version: #.#.#
- Laravel Version: #.#.#
- Operating system & Version: #.#.#

### Description:
A clear and concise description of what the bug is.

### Error/Exception Message:
If applicable, paste the full excption to help explain your problem.

### Screenshots:
If applicable, add screenshots to help explain your problem.

### Steps To Reproduce:
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]"
labels: ''
assignees: Mane-Olawale

---

### Problem description
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Propose a solution
A clear and concise description of what you want to happen.
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Laravel Termii Tests

on:
pull_request:
push:
branches:
- master

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- "7.3"
- "7.4"
- "8.0"
dependency-version:
# - prefer-lowest
- prefer-stable

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} tests
steps:
# basically git clone
- uses: actions/checkout@v2

- name: Setup Git
run: |
git --version
git config --global user.email "test@github.com"
git config --global user.name "GitHub Action"
git --version
- name: Setup PHP
# use PHP of specific version
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
coverage: none # disable xdebug, pcov
tools: composer

- name: Install Composer Dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Run PHPUnit Tests
run: composer test
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/Mane-Olawale/laravel-termii).


## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.


## Running Tests

``` bash
$ composer test
```


**Happy coding**!
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
],
"require": {
"php": ">=7.2",
"mane-olawale/termii": "^1.0",
"mane-olawale/termii": "^1.2",
"illuminate/notifications": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0"
},
"require-dev": {
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0",
"phpunit/phpunit": "~8.0|~9.0",
"mockery/mockery": "~1.4"
},
Expand All @@ -36,7 +37,7 @@
}
},
"scripts": {
"tests": "./vendor/bin/phpunit --verbose"
"test": "./vendor/bin/phpunit --verbose"
},
"extra": {
"laravel": {
Expand Down
2 changes: 1 addition & 1 deletion config/termii.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Sms Name for Termii message
*
*/
"sms_name" => env('TERMII_SMS_NAME', env('APP_NAME','Termii')),
"sms_name" => env('TERMII_SMS_NAME', env('APP_NAME', 'Termii')),

/**
* User agent for Termii message
Expand Down
6 changes: 2 additions & 4 deletions src/Channels/TermiiSmsChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TermiiSmsChannel
* @param string $from
* @return void
*/
public function __construct( Client $termii, string $from)
public function __construct(Client $termii, string $from)
{
$this->from = $from;
$this->termii = $termii;
Expand All @@ -54,12 +54,10 @@ public function send($notifiable, Notification $notification)
$message = new TermiiMessage($message);
}

$client = ($message->client instanceof Client)? $message->client : $this->termii;
$client = ($message->client instanceof Client) ? $message->client : $this->termii;

$result = $client->sms->send($to, $message->getContent(), $message->from ?? $this->from, $message->channel);

return $result;

}

}
16 changes: 2 additions & 14 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php
<?php

namespace ManeOlawale\Laravel\Termii\Commands;

use Illuminate\Console\Command;

class InstallCommand extends Command
{


/**
* The name and signature of the console command.
*
Expand All @@ -32,13 +30,9 @@ public function __construct()
parent::__construct();
}




/**
* Execute the console command.
*
*
* @return mixed
*/
public function handle()
Expand All @@ -48,17 +42,11 @@ public function handle()
sleep(2);

$this->call('vendor:publish', [

'--tag' => 'termii.config'

]);

$this->line("");
sleep(2);

$this->line("<info> Termii installed sucessfully!!</info>");


}

}
}
Loading

0 comments on commit 424c8d1

Please sign in to comment.