-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c0dafe0
Showing
13 changed files
with
472 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
* text=auto | ||
|
||
/build export-ignore | ||
/tests export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.travis.yml export-ignore | ||
gulpfile.js | ||
nitpick.json export-ignore | ||
phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/vendor | ||
/node_modules | ||
phpunit.xml | ||
/build | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
language: php | ||
|
||
php: | ||
- 5.5.9 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
|
||
env: | ||
global: | ||
- setup=basic | ||
|
||
matrix: | ||
include: | ||
- php: 7.0 | ||
env: setup=lowest | ||
- php: 7.0 | ||
env: setup=stable | ||
- php: 7.1 | ||
env: setup=lowest | ||
- php: 7.1 | ||
env: setup=stable | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini | ||
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | ||
- travis_retry composer self-update | ||
|
||
install: | ||
- if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-source; fi | ||
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-source --no-interaction --prefer-stable; fi | ||
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-source --no-interaction --prefer-lowest --prefer-stable; fi | ||
|
||
before_script: mkdir -p build/logs | ||
|
||
script: vendor/bin/phpunit | ||
|
||
after_script: vendor/bin/coveralls -v -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "spinen/laravel-discourse-sso", | ||
"description": "Integrate Discourse SSO into Laravel.", | ||
"keywords": [ | ||
"discourse", | ||
"laravel", | ||
"library", | ||
"single sign on", | ||
"spinen", | ||
"sso" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Jimmy Puckett", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.5.9", | ||
"cviebrock/discourse-php": "^0.9.3", | ||
"illuminate/support": "~5.1.10|5.2.*|5.3.*|5.4.*" | ||
}, | ||
"require-dev": { | ||
"mockery/mockery": "^0.9.1", | ||
"phpunit/phpunit": "~4.0|~5.0", | ||
"psy/psysh": "^0.5.1", | ||
"satooshi/php-coveralls": "^0.6.1|^1", | ||
"symfony/var-dumper": "~2.7|~3.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Spinen\\Discourse\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Spinen\\Discourse\\": "tests" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Spinen\\Discourse\\SsoServiceProvider" | ||
], | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var gulp = require('gulp'); | ||
var phpunit = require('gulp-phpunit'); | ||
var notify = require('gulp-notify') | ||
|
||
var paths = { | ||
tests: ['tests/**/*Test.php'], | ||
}; | ||
|
||
// Lint the shell code | ||
gulp.task('phpunit', function () { | ||
return gulp.src(paths.tests, {read: false}) | ||
.pipe(phpunit()) | ||
.pipe(notify(function (file) { | ||
// TODO: Give alert of pass/fail | ||
return file.path | ||
})) | ||
}) | ||
|
||
// Rerun the task when a file changes | ||
gulp.task('watch', function() { | ||
gulp.watch(paths.tests, ['phpunit']); | ||
}); | ||
|
||
// The default task (called when you run `gulp` from cli) | ||
gulp.task('default', ['phpunit']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ignore": [ | ||
"tests/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
This is the "dist(ribution)" phpunit.xml.dist file. It sets the defaults that are then over written by any files in | ||
phpunit.xml, which is then over wrote by flags passed in via the command line. The plan is that this file is to be | ||
used by ci to do the full suit of tests, and a developer can copy this file to phpunit.xml to trim down some of the | ||
options. | ||
--> | ||
|
||
<phpunit addUncoveredFilesFromWhitelist="true" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
processUncoveredFilesFromWhitelist="true" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
verbose="true"> | ||
|
||
<testsuites> | ||
<testsuite name="Laravel Discourse SSO Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<php> | ||
<!-- <env name="VARIABLE" value="value"/> --> | ||
</php> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
<exclude> | ||
<!--<file>src/file.php</file>--> | ||
<directory suffix=".php">src/config</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<log type="coverage-html" | ||
target="./build/coverage" | ||
title="Laravel Discourse SSO Test Suite" | ||
charset="UTF-8" | ||
yui="true" | ||
highlight="true" | ||
lowUpperBound="35" | ||
highLowerBound="70"/> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
<log type="json" target="./build/logs/logfile.json"/> | ||
<log type="junit" target="./build/logs/junit.xml" | ||
logIncompleteSkipped="true"/> | ||
</logging> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# SPINEN's Discourse SSO for Laravel | ||
|
||
[](https://packagist.org/packages/spinen/laravel-discourse-sso) | ||
[](https://packagist.org/packages/spinen/laravel-discourse-sso) | ||
[](https://packagist.org/packages/spinen/laravel-discourse-sso) | ||
[](https://www.versioneye.com/php/spinen:laravel-discourse-sso/0.1.1) | ||
[](https://packagist.org/packages/spinen/laravel-discourse-sso) | ||
|
||
[Discourse](https://www.discourse.org) is a great online forum software that supports Single Sign On ([SSO](https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045)). There is a great PHP library that handles all of the heavy lifting to make the SSO work called [cviebrock/discourse-php](https://github.com/cviebrock/discourse-php), which this package uses. This package is loosely based on the work done by [jaewun/discourse-sso-laravel](https://github.com/jaewun/discourse-sso-laravel). | ||
|
||
## Build Status | ||
|
||
| Branch | Status | Coverage | Code Quality | | ||
| ------ | :----: | :------: | :----------: | | ||
| Develop | [](https://travis-ci.org/spinen/laravel-discourse-sso) | [](https://coveralls.io/github/spinen/laravel-discourse-sso?branch=develop) | [](https://scrutinizer-ci.com/g/spinen/laravel-discourse-sso/?branch=develop) | | ||
| Master | [](https://travis-ci.org/spinen/laravel-discourse-sso) | [](https://coveralls.io/github/spinen/laravel-discourse-sso?branch=master) | [](https://scrutinizer-ci.com/g/spinen/laravel-discourse-sso/?branch=master) | | ||
|
||
## Prerequisite | ||
|
||
As side from Laravel >= 5.1, there is 1 package that is required. | ||
|
||
* ["cviebrock/discourse-php": "^0.9.3",](https://github.com/briannesbitt/Carbon) | ||
|
||
## Install | ||
|
||
Install Discourse SSO for Laravel: | ||
|
||
```bash | ||
$ composer require spinen/laravel-discourse-sso | ||
``` | ||
|
||
### For >= Laravel 5.5, you are done with the Install | ||
|
||
The package uses the auto registration feature | ||
|
||
### For < Laravel 5.5, you have to register the Service Provider | ||
|
||
Add the Service Provider to `config/app.php`: | ||
|
||
```php | ||
'providers' => [ | ||
// ... | ||
Spinen\Discourse\SsoServiceProvider::class, | ||
]; | ||
``` | ||
|
||
## Configuration | ||
|
||
All of the configuration values are stored in under a `discourse` key in `config/services.php`. Here is the array to add... | ||
|
||
TODO: Put all of the config stuff here | ||
|
||
## Using the package | ||
|
||
TODO: Fill this in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Spinen\Discourse; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
/** | ||
* Class SsoServiceProvider | ||
* | ||
* @package Spinen\GarbageMan | ||
*/ | ||
class SsoServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Perform post-registration booting of services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Spinen\Discourse; | ||
|
||
use ArrayAccess as Application; | ||
use Illuminate\Support\ServiceProvider; | ||
use Mockery; | ||
|
||
class SsoServiceProviderTest extends TestCase | ||
{ | ||
/** | ||
* @var Mockery\Mock | ||
*/ | ||
protected $application_mock; | ||
|
||
/** | ||
* @var Mockery\Mock | ||
*/ | ||
protected $events_mock; | ||
|
||
/** | ||
* @var Mockery\Mock | ||
*/ | ||
protected $purge_command_mock; | ||
|
||
/** | ||
* @var ServiceProvider | ||
*/ | ||
protected $service_provider; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setUpMocks(); | ||
|
||
$this->service_provider = new SsoServiceProvider($this->application_mock); | ||
} | ||
|
||
private function setUpMocks() | ||
{ | ||
$this->events_mock = Mockery::mock(Events::class); | ||
$this->events_mock->shouldReceive('listen') | ||
->withAnyArgs() | ||
->andReturnNull(); | ||
|
||
$this->application_mock = Mockery::mock(Application::class); | ||
$this->application_mock->shouldReceive('offsetGet') | ||
->zeroOrMoreTimes() | ||
->with('events') | ||
->andReturn($this->events_mock); | ||
|
||
$this->purge_command_mock = Mockery::mock(PurgeCommand::class); | ||
} | ||
|
||
/** | ||
* @test | ||
* @group unit | ||
*/ | ||
public function it_can_be_constructed() | ||
{ | ||
$this->assertInstanceOf(SsoServiceProvider::class, $this->service_provider); | ||
} | ||
|
||
/** | ||
* @test | ||
* @group unit | ||
*/ | ||
public function it_boots_the_service() | ||
{ | ||
$this->assertNull($this->service_provider->boot()); | ||
// NOTE: It would be nice to verify that the config got set. | ||
} | ||
} |
Oops, something went wrong.