Skip to content

Commit

Permalink
Remove fos user bundle dependencies support sf4
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisaha committed Dec 19, 2017
1 parent 348df66 commit 0ccfb47
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 140 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -2,12 +2,14 @@ language: php
dist: trusty

php:
- 7.2
- 7.1
- 7.0
- 5.6
- hhvm

env:
- SYMFONY_VERSION=4.0.*
- SYMFONY_VERSION=3.4.*
- SYMFONY_VERSION=3.3.*
- SYMFONY_VERSION=3.2.*
- SYMFONY_VERSION=2.8.*
Expand Down
1 change: 0 additions & 1 deletion README.md
@@ -1,7 +1,6 @@
Easy Audit
==========
[![Build Status](https://travis-ci.org/xiidea/EasyAuditBundle.svg?branch=master)](https://travis-ci.org/xiidea/EasyAuditBundle)
[![HHVM Status](http://hhvm.h4cc.de/badge/xiidea/easy-audit.svg)](http://hhvm.h4cc.de/package/xiidea/easy-audit)
[![Coverage Status](https://coveralls.io/repos/xiidea/EasyAuditBundle/badge.svg?branch=master&service=github)](https://coveralls.io/github/xiidea/EasyAuditBundle?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/xiidea/EasyAuditBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/xiidea/EasyAuditBundle/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/xiidea/easy-audit/v/stable.png)](https://packagist.org/packages/xiidea/easy-audit)
Expand Down
35 changes: 0 additions & 35 deletions Resolver/UserEventCommand/ImplicitLoginCommand.php

This file was deleted.

49 changes: 0 additions & 49 deletions Resolver/UserEventCommand/PasswordChangedCommand.php

This file was deleted.

4 changes: 0 additions & 4 deletions Resolver/UserEventResolver.php
Expand Up @@ -14,9 +14,7 @@
use Symfony\Component\EventDispatcher\Event;
use Xiidea\EasyAuditBundle\Common\UserAwareComponent;
use Xiidea\EasyAuditBundle\Resolver\UserEventCommand\AuthenticationFailedCommand;
use Xiidea\EasyAuditBundle\Resolver\UserEventCommand\ImplicitLoginCommand;
use Xiidea\EasyAuditBundle\Resolver\UserEventCommand\InteractiveLoginCommand;
use Xiidea\EasyAuditBundle\Resolver\UserEventCommand\PasswordChangedCommand;
use Xiidea\EasyAuditBundle\Resolver\UserEventCommand\ResolverCommand;

/** Custom Event Resolver Example For FosUserBundle */
Expand All @@ -29,9 +27,7 @@ class UserEventResolver extends UserAwareComponent implements EventResolverInter
public function __construct()
{
$this->commands = array(
'fos_user.change_password.edit.completed' => new PasswordChangedCommand(),
'security.interactive_login' => new InteractiveLoginCommand($this),
'fos_user.security.implicit_login' => new ImplicitLoginCommand(),
'security.authentication.failure' => new AuthenticationFailedCommand(),
);
}
Expand Down
2 changes: 0 additions & 2 deletions Resources/doc/custom-resolver.md
Expand Up @@ -44,7 +44,5 @@ You can now use this resolver for specific event by setting following configurat
xiidea_easy_audit:
custom_resolvers :
security.interactive_login : custom.event_resolver.service
fos_user.security.implicit_login : custom.event_resolver.service


```
4 changes: 2 additions & 2 deletions Tests/Fixtures/Event/DummyFilterUserResponseEvent.php
Expand Up @@ -12,10 +12,10 @@
namespace Xiidea\EasyAuditBundle\Tests\Fixtures\Event;


use FOS\UserBundle\Event\FilterUserResponseEvent;
use Symfony\Component\EventDispatcher\Event;
use Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\UserEntity;

class DummyFilterUserResponseEvent extends FilterUserResponseEvent
class DummyFilterUserResponseEvent extends Event
{
private $_user;

Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/CommonTest.php
Expand Up @@ -80,7 +80,7 @@ public function testMultipleChannel()
);

$container->get('event_dispatcher')->dispatch($name."2",
new WithEmbeddedResolver($name."2")
new WithEmbeddedResolver()
);

$logFile = realpath($container->getParameter('kernel.cache_dir') . DIRECTORY_SEPARATOR . "audit.log");
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/TestKernel.php
Expand Up @@ -51,12 +51,12 @@ public function registerBundles()

public function getCacheDir()
{
return sys_get_temp_dir().'/XiideaEasyAuditBundle/cache/'.substr(sha1($this->config), 0, 6);
return sys_get_temp_dir() . '/' . substr(sha1($this->config), 0, 6) . '/XiideaEasyAuditBundle/cache';
}

public function getLogDir()
{
return sys_get_temp_dir().'/XiideaEasyAuditBundle/logs/'.substr(sha1($this->config), 0, 6);
return sys_get_temp_dir() . '/' . substr(sha1($this->config), 0, 6) . '/XiideaEasyAuditBundle/logs';
}

public function registerContainerConfiguration(LoaderInterface $loader)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/config/common/framework.yml
Expand Up @@ -4,7 +4,7 @@ framework:
session:
storage_id: session.storage.filesystem
router:
resource: %kernel.root_dir%/config/common/routing.yml
resource: "%kernel.root_dir%/config/common/routing.yml"

services:
logger:
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/config/switchuser.yml
Expand Up @@ -4,7 +4,7 @@ imports:
framework:
validation: { enabled: true, enable_annotations: true }
router:
resource: %kernel.root_dir%/config/common/logiin_routing.yml
resource: "%kernel.root_dir%/config/common/logiin_routing.yml"
csrf_protection: true
form: true
default_locale: en
Expand Down
37 changes: 0 additions & 37 deletions Tests/Resolver/UserEventResolverTest.php
Expand Up @@ -17,7 +17,6 @@
use Xiidea\EasyAuditBundle\Tests\Fixtures\Event\Basic;
use Xiidea\EasyAuditBundle\Tests\Fixtures\Event\DummyAuthenticationFailureEvent;
use Xiidea\EasyAuditBundle\Tests\Fixtures\Event\DummyFilterUserResponseEvent;
use Xiidea\EasyAuditBundle\Tests\Fixtures\Event\DummyUserEvent;
use Xiidea\EasyAuditBundle\Tests\Fixtures\ORM\UserEntity;

class UserEventResolverTest extends TestCase
Expand Down Expand Up @@ -65,21 +64,6 @@ public function testUnlistedEvent()
$this->assertEquals(array('type' => 'any_random_event', 'description' => 'any_random_event'), $auditLog);
}

public function testPasswordChangedEvent()
{
$event = new DummyFilterUserResponseEvent(new UserEntity());

$auditLog = $this->eventResolver->getEventLogInfo($event, 'fos_user.change_password.edit.completed');

$this->assertNotNull($auditLog);

$this->assertEquals(array(
'description' => "Password of user 'admin' Changed Successfully",
'type' => "Password Changed"
), $auditLog);

}

public function testLoginEvent()
{
$this->initiateContainerWithSecurityContext();
Expand All @@ -97,17 +81,6 @@ public function testLoginEvent()
),$auditLog);
}

public function testLoginUsingRememberMeService() {
$event = new DummyUserEvent(new UserEntity());

$auditLog = $this->eventResolver->getEventLogInfo($event, 'fos_user.security.implicit_login');

$this->assertEquals(array (
'description' => "User 'admin' Logged in Successfully using remember me service",
'type' => 'User Logged in',
),$auditLog);
}

public function testAuthenticationFailureEvent()
{
$event = new DummyAuthenticationFailureEvent();
Expand All @@ -133,16 +106,6 @@ public function testAuthenticationFailedCommandWithIncompatibleEventObject()
$this->assertIncompatibleEventObject('security.authentication.failure');
}

public function testImplicitLoginCommandWithIncompatibleEventObject()
{
$this->assertIncompatibleEventObject('fos_user.security.implicit_login');
}

public function testPasswordChangedCommandWithIncompatibleEventObject()
{
$this->assertIncompatibleEventObject('fos_user.change_password.edit.completed');
}


protected function initiateContainerWithSecurityContext()
{
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Expand Up @@ -2,7 +2,7 @@
"name": "xiidea/easy-audit",
"type": "symfony-bundle",
"description": "A Symfony Bundle To Log Selective Events. It is easy to configure and easy to customize for your need",
"keywords": ["Event Log", "Audit Log", "Symfony2", "Symfony3", "Audit trail"],
"keywords": ["Event Log", "Audit Log", "Symfony2", "Symfony3", "Symfony4", "Audit trail"],
"license": "MIT",
"homepage": "http://xiidea.github.io/EasyAuditBundle/",
"authors": [
Expand All @@ -19,14 +19,13 @@
"require": {
"php": "^5.6 || ^7.0",
"psr/log": "^1",
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
"symfony/security-bundle": "^2.7 || ^3.0 || ^4.0"
"symfony/framework-bundle": ">=2.7 <5.0.0",
"symfony/security-bundle": ">=2.7 <5.0.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0 || ^6.0",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"friendsofsymfony/user-bundle": "^2.0",
"satooshi/php-coveralls": "~1.0"
},
"autoload": {
Expand Down

0 comments on commit 0ccfb47

Please sign in to comment.