cleanup & refactor

This commit is contained in:
Nicolas Le Goff
2012-08-29 14:48:35 +02:00
parent 7d857e59dd
commit ed946cc026
26 changed files with 90 additions and 521 deletions

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
protected $StubbedACL;
public static $createdCollections = array();
public function createApplication()
@@ -41,46 +40,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
parent::tearDownAfterClass();
}
public function setUp()
{
parent::setUp();
$this->client = $this->createClient();
$this->StubbedACL = $this->getMockBuilder('\ACL')
->disableOriginalConstructor()
->getMock();
}
public function setAdmin($bool)
{
$stubAuthenticatedUser = $this->getMockBuilder('\User_Adapter')
->setMethods(array('is_admin', 'ACL'))
->disableOriginalConstructor()
->getMock();
$stubAuthenticatedUser->expects($this->any())
->method('is_admin')
->will($this->returnValue($bool));
$this->StubbedACL->expects($this->any())
->method('has_right_on_base')
->will($this->returnValue($bool));
$stubAuthenticatedUser->expects($this->any())
->method('ACL')
->will($this->returnValue($this->StubbedACL));
$stubCore = $this->getMockBuilder('\Alchemy\Phrasea\Core')
->setMethods(array('getAuthenticatedUser'))
->getMock();
$stubCore->expects($this->any())
->method('getAuthenticatedUser')
->will($this->returnValue($stubAuthenticatedUser));
$this->app['phraseanet.core'] = $stubCore;
}
public function getJson($response)
{
$this->assertTrue($response->isOk());