Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Fix Admin deprecated class usage (#391)
Browse files Browse the repository at this point in the history
The Admin class has been deprecated in favour of AbstractAdmin,
and has been removed in 3.1 version of admin-bundle.
  • Loading branch information
ju1ius authored and soullivaneuh committed Jun 21, 2016
1 parent 494fe75 commit c5a8326
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Admin/Admin.php
Expand Up @@ -13,7 +13,7 @@

use PHPCR\Util\PathHelper;
use PHPCR\Util\UUIDHelper;
use Sonata\AdminBundle\Admin\Admin as BaseAdmin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Route\RouteCollection;

Expand All @@ -24,7 +24,7 @@
*
* @author Uwe Jäger <uwej711@googlemail.com>
*/
class Admin extends BaseAdmin
class Admin extends AbstractAdmin
{
/**
* Path to the root node in the repository under which documents of this
Expand Down
22 changes: 22 additions & 0 deletions Tests/Admin/AdminTest.php
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Sonata\DoctrinePHPCRAdminBundle\Tests\Admin;

use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin;

class AdminTest extends \PHPUnit_Framework_TestCase
{
public function testItCanBeInstanciated()
{
$admin = new Admin('', '', '');
}
}
2 changes: 1 addition & 1 deletion Tests/Builder/ListBuilderTest.php
Expand Up @@ -102,7 +102,7 @@ private function setupAddField()

//AdminInterface doesn't implement methods called in addField,
//so we mock Admin
$this->admin = $this->getMock('\Sonata\AdminBundle\Admin\Admin', array(), array(), '', false);
$this->admin = $this->getMock('\Sonata\AdminBundle\Admin\AbstractAdmin', array(), array(), '', false);
$this->admin->expects($this->any())
->method('getModelManager')
->will($this->returnValue($this->modelManager));
Expand Down
12 changes: 9 additions & 3 deletions Tests/Route/PathInfoBuilderSlashesTest.php
Expand Up @@ -19,12 +19,16 @@ public function testBuild()
{
$collectionChild = $this->getMock('Sonata\\AdminBundle\\Route\\RouteCollection', array(), array(), '', false);

$adminChild = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock();
$adminChild = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\AbstractAdmin')
->disableOriginalConstructor()
->getMock();
$adminChild->expects($this->once())
->method('getRoutes')
->will($this->returnValue($collectionChild));

$admin = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock();
$admin = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\AbstractAdmin')
->disableOriginalConstructor()
->getMock();
$admin->expects($this->once())
->method('getChildren')
->will($this->returnValue(array($adminChild)));
Expand All @@ -43,7 +47,9 @@ public function testBuild()

public function testBuildWithAcl()
{
$admin = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock();
$admin = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\AbstractAdmin')
->disableOriginalConstructor()
->getMock();
$admin->expects($this->once())
->method('getChildren')
->will($this->returnValue(array()));
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -19,7 +19,7 @@
"php": "^5.5 || ^7.0",
"doctrine/phpcr-bundle": "^1.1",
"doctrine/phpcr-odm": "^1.1",
"sonata-project/admin-bundle": "^3.0",
"sonata-project/admin-bundle": "^3.1",
"sonata-project/block-bundle": "^3.0",
"symfony-cmf/resource-rest-bundle": "^1.0@dev",
"symfony-cmf/tree-browser-bundle": "^2.0@dev",
Expand Down

0 comments on commit c5a8326

Please sign in to comment.