Skip to content
This repository has been archived by the owner on Jun 1, 2019. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Mar 31, 2015
1 parent 0152233 commit 19af576
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
4 changes: 3 additions & 1 deletion composer.json
Expand Up @@ -17,9 +17,11 @@
"require": {
"php": ">=5.4.0",
"illuminate/support": "5.*"

},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "~4.0",
"mockery/mockery": "0.9.*"
},
"autoload": {
"classmap": [
Expand Down
5 changes: 0 additions & 5 deletions phpspec.yml

This file was deleted.

17 changes: 17 additions & 0 deletions phpunit.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
8 changes: 5 additions & 3 deletions src/Spatie/Activitylog/ActivitylogSupervisor.php
@@ -1,5 +1,6 @@
<?php namespace Spatie\Activitylog;

use Illuminate\Config\Repository;
use Spatie\Activitylog\Handlers\DefaultLaravelHandler;
use Auth;
use Request;
Expand All @@ -16,12 +17,13 @@ class ActivitylogSupervisor
* Create the logsupervisor using a default Handler
* Also register Laravels Log Handler if needed.
*
* @param Handlers\ActivitylogHandler $handler
* @param Handlers\ActivitylogHandlerInterface $handler
* @param Repository $config
*/
public function __construct(Handlers\ActivitylogHandler $handler)
public function __construct(Handlers\ActivitylogHandlerInterface $handler, Repository $config)
{
$this->logHandlers[] = $handler;
if (Config::get('activitylog.alsoLogInDefaultLog')) {
if ($config->get('activitylog.alsoLogInDefaultLog')) {
$this->logHandlers[] = new DefaultLaravelHandler();
}
}
Expand Down
28 changes: 28 additions & 0 deletions tests/ActivityLogSupervisorTest.php
@@ -0,0 +1,28 @@
<?php

use Illuminate\Support\Collection;

class ActivityLogSupervistorTest extends PHPUnit_Framework_TestCase
{

protected $logHandler;
protected $activityLogSupervisor;
protected $config;

public function setUp()
{
$this->logHandler = Mockery::mock('\Spatie\Activitylog\Handlers\EloquentHandler');
$this->config = Mockery::mock('\Illuminate\Config\Repository');

$this->config->shouldReceive('get')->andReturn(false);
$this->activityLogSupervisor = new \Spatie\Activitylog\ActivitylogSupervisor($this->logHandler, $this->config);
}

/**
* @test
*/
public function testGetVisitorsAndPageViews()
{
$this->assertTrue(true);
}
}

0 comments on commit 19af576

Please sign in to comment.