Fix CS in unit tests + remove unused unit tests

This commit is contained in:
Romain Neutron
2012-05-10 17:08:01 +02:00
parent 21c2d15754
commit 17cd58f5e1
224 changed files with 16423 additions and 22543 deletions

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var ACL
*/
@@ -22,25 +21,19 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
* In case first test fails
*/
$usr_id = User_Adapter::get_usr_id_from_login('test_phpunit2');
try
{
try {
$appbox = appbox::get_instance(\bootstrap::getCore());
$template = User_Adapter::getInstance($usr_id, $appbox);
$template->delete();
}
catch (Exception $e)
{
} catch (Exception $e) {
}
$usr_id = User_Adapter::get_usr_id_from_login('test_phpunit3');
try
{
try {
$appbox = appbox::get_instance(\bootstrap::getCore());
$cobaye = User_Adapter::getInstance($usr_id, $appbox);
$cobaye->delete();
}
catch (Exception $e)
{
} catch (Exception $e) {
}
parent::tearDownAfterClass();
@@ -53,10 +46,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$template->set_template(self::$user);
$base_ids = array();
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$base_ids[] = $base_id;
}
@@ -65,10 +56,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$cobaye = User_Adapter::create($appbox, 'test_phpunit3', 'blabla3', 'test3@example.com', false);
$cobaye->ACL()->apply_model($template, $base_ids);
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$this->assertTrue($cobaye->ACL()->has_access_to_base($base_id));
}
@@ -83,10 +72,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_ids = array();
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
self::$user->ACL()->revoke_access_from_bases(array($base_id));
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
@@ -97,8 +84,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
}
self::$user->ACL()->revoke_access_from_bases($base_ids);
foreach ($base_ids as $base_id)
{
foreach ($base_ids as $base_id) {
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
}
}
@@ -107,10 +93,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
self::$user->ACL()->give_access_to_base(array($base_id));
@@ -123,12 +107,10 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
$sbas_id = $databox->get_sbas_id();
$base_ids = array();
foreach ($databox->get_collections() as $collection)
{
foreach ($databox->get_collections() as $collection) {
$base_ids[] = $collection->get_base_id();
}
@@ -143,12 +125,10 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testRevoke_unused_sbas_rights()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
$sbas_id = $databox->get_sbas_id();
$base_ids = array();
foreach ($databox->get_collections() as $collection)
{
foreach ($databox->get_collections() as $collection) {
$base_ids[] = $collection->get_base_id();
}
@@ -168,10 +148,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testSet_quotas_on_base()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$droits = 50;
$restes = 40;
@@ -195,21 +173,16 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$first = true;
$base_ref = null;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
self::$user->ACL()->give_access_to_base(array($base_id));
if ($first)
{
if ($first) {
self::$user->ACL()->update_rights_to_base($base_id, array('imgtools' => true, 'chgstatus' => true, 'canaddrecord' => true, 'canputinalbum' => true));
$base_ref = $base_id;
}
else
{
} else {
self::$user->ACL()->duplicate_right_from_bas($base_ref, $base_id);
}
@@ -249,10 +222,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
);
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
self::$user->ACL()->give_access_to_base(array($base_id));
self::$user->ACL()->update_rights_to_base($base_id, $rights_false);
@@ -283,10 +254,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$droits = 50;
$restes = 40;
@@ -306,10 +275,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testRemove_remaining()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$droits = 50;
$restes = 40;
@@ -345,8 +312,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertFalse(self::$user->ACL()->has_right('bas_modify_struct'));
$this->assertFalse(self::$user->ACL()->has_right('bas_modif_th'));
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
self::$user->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights);
break;
@@ -375,8 +341,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
);
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
self::$user->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_false);
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
@@ -399,10 +364,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_mask_and()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
self::$user->ACL()->give_access_to_base(array($base_id));
@@ -423,10 +386,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_mask_xor()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
self::$user->ACL()->give_access_to_base(array($base_id));
@@ -449,10 +410,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_ids = array();
$n = 0;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_ids[] = $collection->get_base_id();
$n ++;
}
@@ -471,8 +430,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$sql = 'SELECT actif FROM basusr WHERE usr_id = :usr_id AND base_id = :base_id';
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($bases as $base_id)
{
foreach ($bases as $base_id) {
$stmt->execute(array(':usr_id' => $appbox->get_session()->get_usr_id(), ':base_id' => $base_id));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$this->assertEquals(1, $row['actif']);
@@ -497,8 +455,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
}
self::$user->ACL()->give_access_to_base($base_ids);
foreach ($bases as $base_id)
{
foreach ($bases as $base_id) {
$this->assertTrue(self::$user->ACL()->has_access_to_base($base_id));
}
$stmt->closeCursor();
@@ -510,10 +467,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_ids = array();
$n = 0;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_ids[] = $collection->get_base_id();
$n ++;
}
@@ -528,17 +483,13 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(count($bases), count($base_ids));
$this->assertEquals($n, count($base_ids));
foreach ($bases as $base_id)
{
try
{
foreach ($bases as $base_id) {
try {
$collection = collection::get_from_base_id($base_id);
$this->assertTrue($collection instanceof collection);
$this->assertEquals($base_id, $collection->get_base_id());
unset($collection);
}
catch (Exception $e)
{
} catch (Exception $e) {
$this->fail('get granted base should returned OK collection');
}
}
@@ -549,8 +500,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$appbox = appbox::get_instance(\bootstrap::getCore());
$sbas_ids = array();
$n = 0;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
$sbas_ids[] = $databox->get_sbas_id();
$n ++;
}
@@ -561,16 +511,12 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(count($sbas), count($sbas_ids));
$this->assertEquals($n, count($sbas_ids));
foreach ($sbas as $sbas_id => $databox)
{
try
{
foreach ($sbas as $sbas_id => $databox) {
try {
$this->assertTrue($databox instanceof databox);
$this->assertEquals($sbas_id, $databox->get_sbas_id());
unset($databox);
}
catch (Exception $e)
{
} catch (Exception $e) {
$this->fail('get granted sbas should returned OK collection');
}
}
@@ -580,11 +526,9 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
$base_ids = array();
foreach ($databox->get_collections() as $collection)
{
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$base_ids[] = $base_id;
}
@@ -601,10 +545,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertFalse(self::$user->ACL()->has_access_to_module('report'));
$found = false;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$base_ids[] = $base_id;
self::$user->ACL()->update_rights_to_base($base_id, array('canreport' => true));
@@ -618,8 +560,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertFalse(self::$user->ACL()->has_access_to_module('thesaurus'));
$this->assertFalse(self::$user->ACL()->has_access_to_module('upload'));
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), array('bas_modif_th' => true));
$found = true;
}
@@ -629,10 +570,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$found = false;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$base_ids[] = $base_id;
self::$user->ACL()->update_rights_to_base($base_id, array('canaddrecord' => true));
@@ -653,10 +592,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$found = false;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
if ( ! self::$user->ACL()->has_access_to_base($base_id))
@@ -702,10 +639,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$found = false;
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
if ( ! self::$user->ACL()->has_access_to_base($base_id))
@@ -751,5 +686,4 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
$this->testget_limits();
}
}

View File

@@ -55,6 +55,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
public function tearDown()
{
$this->unsetToken();
parent::tearDown();
}
public static function setUpBeforeClass()
@@ -91,6 +92,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
self::$adminAccount->delete();
self::$adminApplication->delete();
}
parent::tearDownAfterClass();
}
public function createApplication()

View File

@@ -61,6 +61,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
public function tearDown()
{
$this->unsetToken();
parent::tearDown();
}
public static function setUpBeforeClass()
@@ -96,6 +97,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
self::$adminAccount->delete();
self::$adminApplication->delete();
}
parent::tearDownAfterClass();
}
public function createApplication()

View File

@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Response;
class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
protected $feed;
protected $entry;
@@ -15,8 +14,6 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
protected $validation_basket;
protected static $need_records = 1;
// protected static $need_subdefs = true;
public function setUp()
{
parent::setUp();
@@ -323,5 +320,4 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertObjectHasAttribute('datas', $datas);
$this->assertObjectHasAttribute('error', $datas);
}
}

View File

@@ -9,11 +9,6 @@ use Silex\WebTestCase;
* Test oauthv2 flow based on ietf authv2 spec
* @link http://tools.ietf.org/html/draft-ietf-oauth-v2-18
*/
/**
*
*
*/
class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
@@ -30,29 +25,21 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$parameters = array(
'type' => 'web'
, 'name' => 'test'
, 'description' => 'une description'
, 'callback' => 'http://callback.com/callback/'
, 'website' => 'http://website.com/'
);
self::$appli = API_OAuth2_Application::create(appbox::get_instance(\bootstrap::getCore()), self::$user, 'test');
self::$appli->set_description('une description')
->set_redirect_uri('http://callback.com/callback/')
->set_website('http://website.com/')
->set_type(API_OAuth2_Application::WEB_TYPE);
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
if (self::$appli !== false)
if (self::$appli !== false) {
self::deleteInsertedRow(appbox::get_instance(\bootstrap::getCore()), self::$appli);
}
parent::tearDownAfterClass();
}
public function setUp()
{
@@ -134,10 +121,8 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
{
//session off
$apps = API_OAuth2_Application::load_authorized_app_by_user(appbox::get_instance(\bootstrap::getCore()), self::$user);
foreach($apps as $app)
{
if($app->get_client_id() == self::$appli->get_client_id())
{
foreach ($apps as $app) {
if ($app->get_client_id() == self::$appli->get_client_id()) {
$authorize = true;
$this->client->followRedirects();

View File

@@ -1,20 +1,5 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . '/../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Silex\WebTestCase;
@@ -23,7 +8,6 @@ use Symfony\Component\HttpFoundation\Response;
class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
protected static $need_records = 1;
protected static $need_subdefs = true;
@@ -33,16 +17,6 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient();
}
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
}
public function createApplication()
{
return require __DIR__ . '/../../../../lib/Alchemy/Phrasea/Application/Overview.php';
@@ -54,16 +28,13 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('GET', '/datafiles/' . self::$record_1->get_sbas_id() . '/' . self::$record_1->get_record_id() . '/preview/');
$response = $this->client->getResponse();
if (self::$record_1->get_preview()->get_baseurl() !== '')
{
if (self::$record_1->get_preview()->get_baseurl() !== '') {
$this->assertEquals(302, $response->getStatusCode());
$url = p4string::delEndSlash($registry->get('GV_ServerName')) . $response->headers->get('Location');
$headers = http_query::getHttpHeaders($url);
$this->assertEquals(self::$record_1->get_preview()->get_mime(), $headers['content_type']);
$this->assertEquals(self::$record_1->get_preview()->get_size(), $headers['download_content_length']);
}
else
{
} else {
$this->assertEquals(200, $response->getStatusCode());
$content_disposition = explode(';', $response->headers->get('content-disposition'));
$this->assertEquals($content_disposition[0], 'attachment');
@@ -113,12 +84,9 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('GET', $url);
$response = $this->client->getResponse();
if (self::$record_1->get_preview()->get_baseurl() !== '')
{
if (self::$record_1->get_preview()->get_baseurl() !== '') {
$this->assertEquals(302, $response->getStatusCode());
}
else
{
} else {
$this->assertEquals(200, $response->getStatusCode());
}
@@ -127,5 +95,4 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$response = $this->client->getResponse();
$this->assertEquals(200, $response->getStatusCode());
}
}

View File

@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Response;
class ApplicationRootTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
protected static $need_records = false;
@@ -59,5 +58,4 @@ class ApplicationRootTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$registry->set('GV_allow_search_engine', $original_value, \registry::TYPE_BOOLEAN);
}
}

View File

@@ -21,7 +21,6 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAbstract
* @var \connection_pdo
*/
protected $connection;
protected $registry = array();
public function createApplication()
@@ -194,24 +193,21 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAbstract
public function temporaryReInstall()
{
if (file_exists($this->root . 'config/config.yml.unitTests')) {
if(file_exists($this->root . 'config/config.yml'))
{
if (file_exists($this->root . 'config/config.yml')) {
unlink($this->root . 'config/config.yml');
}
rename($this->root . 'config/config.yml.unitTests', $this->root . 'config/config.yml');
}
if (file_exists($this->root . 'config/services.yml.unitTests')) {
if(file_exists($this->root . 'config/services.yml'))
{
if (file_exists($this->root . 'config/services.yml')) {
unlink($this->root . 'config/services.yml');
}
rename($this->root . 'config/services.yml.unitTests', $this->root . 'config/services.yml');
}
if (file_exists($this->root . 'config/connexions.yml.unitTests')) {
if(file_exists($this->root . 'config/connexions.yml'))
{
if (file_exists($this->root . 'config/connexions.yml')) {
unlink($this->root . 'config/connexions.yml');
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class ApcCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ApcCache
*/
@@ -12,8 +11,7 @@ class ApcCacheTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
if (!extension_loaded('apc'))
{
if ( ! extension_loaded('apc')) {
$this->markTestSkipped('Apc is not installed');
}
$this->object = new \Alchemy\Phrasea\Cache\ApcCache;
@@ -44,6 +42,5 @@ class ApcCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.'
);
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class ArrayCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ArrayCache
*/
@@ -40,6 +39,5 @@ class ArrayCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,43 +0,0 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class ManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Manager
*/
protected $object;
public function setUp()
{
// $this->object = new \Alchemy\Phrasea\Cache\Manager(self::);
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testFlushAll().
*/
public function testFlushAll()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet().
*/
public function testGet()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var MemcacheCache
*/
@@ -14,14 +13,12 @@ class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
{
$this->object = new \Alchemy\Phrasea\Cache\MemcacheCache;
if(!class_exists('Memcache'))
{
if ( ! class_exists('Memcache')) {
$this->markTestSkipped('No memcache extension');
}
$memcache = new Memcache();
if(!@$memcache->connect('localhost', 11211))
{
if ( ! @$memcache->connect('localhost', 11211)) {
$this->markTestSkipped('No memcache server');
}
@@ -53,6 +50,5 @@ class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,20 +1,5 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class RedisTest extends \PhraseanetPHPUnitAbstract
@@ -22,24 +7,17 @@ class RedisTest extends \PhraseanetPHPUnitAbstract
public function testBasics()
{
if (extension_loaded('Redis'))
{
if (extension_loaded('Redis')) {
$redis = new Redis();
try
{
try {
$ok = @$redis->connect('127.0.0.1', 6379);
}
catch(\Exception $e)
{
} catch (\Exception $e) {
$ok = false;
}
if (!$ok)
{
if ( ! $ok) {
$this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis');
}
}
else
{
} else {
$this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis');
}
@@ -66,5 +44,4 @@ class RedisTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($redis, $cache->getRedis());
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class XcacheCacheTest extends \PHPUnit_Framework_TestCase
{
/**
* @var XcacheCache
*/
@@ -12,8 +11,7 @@ class XcacheCacheTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
if(!function_exists('xcache_info'))
{
if ( ! function_exists('xcache_info')) {
$this->markTestSkipped('Xcache not loaded');
}
@@ -45,6 +43,5 @@ class XcacheCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.'
);
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -75,14 +58,11 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($this->client->getResponse()->isRedirect());
try
{
try {
$field = \databox_field::get_instance($databox, $id);
$field->delete();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -103,17 +83,14 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$fields = $databox->get_meta_structure();
$find = false;
foreach ($fields as $field)
{
if ($field->get_name() === databox_field::generateName($name))
{
foreach ($fields as $field) {
if ($field->get_name() === databox_field::generateName($name)) {
$field->delete();
$find = true;
}
}
if (!$find)
{
if ( ! $find) {
$this->fail("should have create a new field");
}
}
@@ -261,6 +238,4 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request("GET", "/description/" . $databox->get_sbas_id() . "/");
$this->assertTrue($this->client->getResponse()->isOk());
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -78,5 +61,4 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$field->delete();
}
}

View File

@@ -7,21 +7,10 @@ use Symfony\Component\HttpFoundation\Response;
class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
public static $account = null;
public static $api = null;
protected $client;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
}
public function setUp()
{
parent::setUp();
@@ -40,8 +29,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
$this->assertTrue($this->client->getResponse()->isOk());
$feeds = Feed_Collection::load_all(appbox::get_instance(\bootstrap::getCore()), self::$user);
foreach ($feeds->get_feeds() as $feed)
{
foreach ($feeds->get_feeds() as $feed) {
$this->assertRegExp('/\/admin\/publications\/feed\/' . $feed->get_id() . '/', $pageContent);
if ($feed->get_collection() != null)
$this->assertRegExp('/' . $feed->get_collection()->get_name() . '/', $pageContent);
@@ -54,10 +42,8 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
{
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
{
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
break;
}
@@ -252,13 +238,10 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
$this->assertTrue($response->isOk());
$feed = new Feed_Adapter($appbox, $feed->get_id());
try
{
try {
$file = new SplFileObject(__DIR__ . '/../../../../testfiles/logocoll1.gif');
$this->fail('logo not deleted');
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
@@ -372,17 +355,12 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
$response = $this->client->getResponse();
$this->assertTrue($response->isRedirect());
try
{
try {
$feed = new Feed_Adapter($appbox, $feed->get_id());
$feed->delete();
$this->fail("fail deleting feed");
}
catch(\Exception $e)
{
} catch (\Exception $e) {
}
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -46,5 +29,4 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request('GET', '/');
$this->assertTrue($this->client->getResponse()->isOk());
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -69,13 +52,10 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$subdefs->add_subdef("image", "name", "class");
$this->client->request("POST", "/subdefs/" . $databox->get_sbas_id() . "/", array('delete_subdef' => 'group_name'));
$this->assertTrue($this->client->getResponse()->isRedirect());
try
{
try {
$subdefs->get_subdef("image", "name");
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -118,5 +98,4 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$subdefs->delete_subdef("image", "name");
}
}

View File

@@ -4,27 +4,11 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
protected $usersParameters;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -32,8 +16,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function setUp()
{
$this->usersParameters = array("users" => implode(';', array(self::$user->get_id(), self::$user_alt1->get_id())));
parent::setUp();
$this->usersParameters = array("users" => implode(';', array(self::$user->get_id(), self::$user_alt1->get_id())));
$this->client = $this->createClient();
}
@@ -62,14 +46,11 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request('POST', '/users/delete/', array('users' => $id));
$response = $this->client->getResponse();
$this->assertTrue($response->isRedirect());
try
{
try {
$user = User_Adapter::getInstance($id, $appbox);
$user->delete();
$this->fail("user not deleted");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -287,18 +268,14 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(is_object($datas));
$this->assertFalse($datas->error);
try
{
try {
$user = \User_Adapter::getInstance((int) $datas->data, $appbox);
$user->delete();
}
catch (\Exception $e)
{
} catch (\Exception $e) {
$this->fail("could not delete created user " . $e->getMessage());
}
}
public function testRouteExportCsv()
{
$this->client->request('POST', '/users/export/csv/');
@@ -309,7 +286,6 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals("attachment; filename=export.txt", $response->headers->get("content-disposition"));
}
public function testResetRights()
{
$appbox = \appbox::get_instance(self::$core);
@@ -318,8 +294,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$user->ACL()->give_access_to_sbas(array_keys($appbox->get_databoxes()));
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($appbox->get_databoxes() as $databox) {
$rights = array(
'bas_manage' => '1'
@@ -330,8 +305,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights);
foreach ($databox->get_collections() as $collection)
{
foreach ($databox->get_collections() as $collection) {
$base_id = $collection->get_base_id();
$user->ACL()->give_access_to_base(array($base_id));
@@ -358,5 +332,4 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertFalse($user->ACL()->has_access_to_base($base_id));
$user->delete();
}
}

View File

@@ -21,11 +21,11 @@ use Symfony\Component\HttpFoundation\Response;
*/
class BoilerPlate extends \PhraseanetWebTestCaseAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
@@ -65,5 +65,4 @@ class BoilerPlate extends \PhraseanetWebTestCaseAbstract
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,28 +1,12 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
protected static $need_records = 2;
@@ -328,8 +312,7 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
foreach ($basket->getElements() as $elements)
{
foreach ($basket->getElements() as $elements) {
$filter = sprintf("form[action='/prod/baskets/%s/reorder/']", $elements->getId());
$this->assertEquals(1, $crawler->filter($filter)->count());
}
@@ -461,7 +444,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(2, $basket->getElements()->count());
}
public function testAddElementToValidationPost()
{
@@ -529,7 +511,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($countDatas < count($datas), 'assert that ' . count($datas) . ' > ' . $countDatas);
}
public function testAddElementPostJSON()
{
$basket = $this->insertOneBasket();
@@ -594,7 +575,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$basket = $em->getRepository('Entities\Basket')->find($Basket_2->getId());
$this->assertInstanceOf('\Entities\Basket', $basket);
$this->assertEquals(1, $basket->getElements()->count());
}
public function testRouteStealElementsJson()
@@ -636,7 +616,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$basket = $em->getRepository('Entities\Basket')->find($Basket_2->getId());
$this->assertInstanceOf('\Entities\Basket', $basket);
$this->assertEquals(1, $basket->getElements()->count());
}
/**
@@ -690,5 +669,4 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(0, $count);
}
}

View File

@@ -8,53 +8,38 @@ use Symfony\Component\HttpFoundation\Response;
class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
{
public static $account = null;
public static $api = null;
protected $client;
protected static $need_records = 1;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
}
public function setUp()
{
parent::setUp();
$this->client = $this->createClient();
try
{
try {
self::$api = Bridge_Api::get_by_api_name(appbox::get_instance(\bootstrap::getCore()), 'apitest');
}
catch (Bridge_Exception_ApiNotFound $e)
{
} catch (Bridge_Exception_ApiNotFound $e) {
self::$api = Bridge_Api::create(appbox::get_instance(\bootstrap::getCore()), 'apitest');
}
try
{
try {
self::$account = Bridge_Account::load_account_from_distant_id(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo');
}
catch (Bridge_Exception_AccountNotFound $e)
{
} catch (Bridge_Exception_AccountNotFound $e) {
self::$account = Bridge_Account::create(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo', 'coucou');
}
}
public function tearDown()
{
parent::tearDown();
if (self::$api instanceof Bridge_Api)
if (self::$api instanceof Bridge_Api) {
self::$api->delete();
if (self::$account instanceof Bridge_Account)
}
if (self::$account instanceof Bridge_Account) {
self::$account->delete();
}
parent::tearDown();
}
public function createApplication()
{
@@ -103,14 +88,10 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
$phpunit = $this;
$crawler
->filter('div')
->reduce(function ($node, $i) use ($phpunit)
{
if (!$node->getAttribute('class'))
{
->reduce(function ($node, $i) use ($phpunit) {
if ( ! $node->getAttribute('class')) {
return false;
}
elseif ($node->getAttribute('class') == 'error_auth')
{
} elseif ($node->getAttribute('class') == 'error_auth') {
$phpunit->fail("Erreur callback");
}
});
@@ -132,19 +113,14 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
$phpunit = $this;
$crawler
->filter('div')
->reduce(function ($node, $i) use ($phpunit)
{
if (!$node->getAttribute('class'))
{
->reduce(function ($node, $i) use ($phpunit) {
if ( ! $node->getAttribute('class')) {
return false;
}
elseif ($node->getAttribute('class') == 'error_auth')
{
} elseif ($node->getAttribute('class') == 'error_auth') {
$phpunit->fail("Erreur callback");
}
});
try
{
try {
self::$account = Bridge_Account::load_account_from_distant_id(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo');
$settings = self::$account->get_settings();
$this->assertEquals("kikoo", $settings->get("auth_token"));
@@ -153,9 +129,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
$settings->delete("auth_token");
$settings->delete("refresh_token");
$settings->delete("access_token");
}
catch (Bridge_Exception_AccountNotFound $e)
{
} catch (Bridge_Exception_AccountNotFound $e) {
$this->fail("No account created after callback");
}
@@ -264,23 +238,17 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
{
self::$account->get_settings()->set("auth_token", "somethingNotNull"); //connected
$url = sprintf("/bridge/action/%s/ajjfhfjozqd/%s/", self::$account->get_id(), self::$account->get_api()->get_connector()->get_default_element_type());
try
{
try {
$crawler = $this->client->request('GET', $url, array("elements_list" => "1;2;3"));
$this->fail("expected Exception here");
}
catch (Exception $e)
{
} catch (Exception $e) {
}
try
{
try {
$crawler = $this->client->request('POST', $url, array("elements_list" => "1;2;3"));
$this->fail("expected Exception here");
}
catch (Exception $e)
{
} catch (Exception $e) {
}
}
@@ -434,5 +402,4 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
$response = $this->client->getResponse();
$this->assertTrue($response->isRedirect());
}
}

View File

@@ -2,29 +2,11 @@
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = 1;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -57,7 +39,6 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($response->isOk());
}
public function testVocabulary()
{
$this->client->request('GET', '/records/edit/vocabulary/Zanzibar/');
@@ -90,5 +71,4 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$datas = json_decode($response->getContent());
$this->assertTrue($datas->success);
}
}

View File

@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Response;
class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
*
* @var Feed_Adapter
@@ -82,15 +81,11 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function tearDown()
{
if ($this->feed instanceof Feed_Adapter)
{
if ($this->feed instanceof Feed_Adapter) {
$this->feed->delete();
}
else if($this->entry instanceof Feed_Entry_Adapter)
{
} else if ($this->entry instanceof Feed_Entry_Adapter) {
$this->entry->delete();
if ($this->publisher instanceof Feed_Publisher_Adapter)
{
if ($this->publisher instanceof Feed_Publisher_Adapter) {
$this->publisher->delete();
}
}
@@ -109,10 +104,8 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('POST', '/feeds/requestavailable/');
$this->assertTrue($this->client->getResponse()->isOk());
$feeds = Feed_Collection::load_all($appbox, self::$user);
foreach ($feeds->get_feeds() as $one_feed)
{
if ($one_feed->is_publisher(self::$user))
{
foreach ($feeds->get_feeds() as $one_feed) {
if ($one_feed->is_publisher(self::$user)) {
$this->assertEquals(1, $crawler->filterXPath("//input[@value='" . $one_feed->get_id() . "']")->count());
}
}
@@ -164,8 +157,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('GET', '/feeds/entry/' . $this->entry->get_id() . '/edit/');
$pageContent = $this->client->getResponse()->getContent();
foreach ($this->entry->get_content() as $content)
{
foreach ($this->entry->get_content() as $content) {
$this->assertEquals(1, $crawler->filterXPath("//input[@value='" . $content->get_id() . "' and @name='item_id']")->count());
}
@@ -334,13 +326,10 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertFalse($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
try
{
try {
Feed_Entry_Adapter::load_from_id($appbox, $this->entry->get_id());
$this->fail("Failed to delete entry");
}
catch (Exception $e)
{
} catch (Exception $e) {
}
}
@@ -401,18 +390,14 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$feeds = Feed_Collection::load_all($appbox, self::$user);
foreach ($feeds->get_feeds() as $one_feed)
{
foreach ($feeds->get_feeds() as $one_feed) {
$path = "//div[@class='submenu']/a[@href='/prod/feeds/feed/" . $one_feed->get_id() . "/']";
$msg = sprintf("user %s has access to feed %s", self::$user->get_id(), $one_feed->get_id());
if ($one_feed->has_access(self::$user))
{
if ($one_feed->has_access(self::$user)) {
$this->assertEquals(1, $crawler->filterXPath($path)->count(), $msg);
}
else
{
} else {
$this->fail('Feed_collection::load_all should return feed where I got access');
}
}
@@ -427,18 +412,14 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('GET', '/feeds/feed/' . $this->feed->get_id() . "/");
$pageContent = $this->client->getResponse()->getContent();
foreach ($feeds->get_feeds() as $one_feed)
{
foreach ($feeds->get_feeds() as $one_feed) {
$path = "//div[@class='submenu']/a[@href='/prod/feeds/feed/" . $one_feed->get_id() . "/']";
$msg = sprintf("user %s has access to feed %s", self::$user->get_id(), $one_feed->get_id());
if ($one_feed->has_access(self::$user))
{
if ($one_feed->has_access(self::$user)) {
$this->assertEquals(1, $crawler->filterXPath($path)->count(), $msg);
}
else
{
} else {
$this->fail('Feed_collection::load_all should return feed where I got access');
}
}
@@ -469,5 +450,4 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$suscribe_link = $this->feed->get_user_link(registry::get_instance(), self::$user, Feed_Adapter::FORMAT_RSS, null, false)->get_href();
$this->assertContains($suscribe_link, $pageContent->texte);
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerLanguageTest extends PhraseanetWebTestCaseAbstract
{
protected $client;
public function setUp()
@@ -43,5 +27,4 @@ class ControllerLanguageTest extends PhraseanetWebTestCaseAbstract
$pageContent = json_decode($this->client->getResponse()->getContent());
$this->assertTrue(is_object($pageContent));
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = 1;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -56,5 +39,4 @@ class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAb
$this->assertTrue($response->isOk());
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
public function createApplication()
@@ -53,5 +52,4 @@ class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
$this->assertTrue($response->isOk());
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = 4;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -73,8 +56,7 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_THUMBNAILGRID
);
foreach ($layouts as $layout)
{
foreach ($layouts as $layout) {
$crawler = $this->client->request('POST', '/printer/print.pdf', array(
'lst' => $lst,
'lay' => $layout
@@ -88,5 +70,4 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($response->isOk());
}
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = 2;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -159,5 +142,4 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(is_array($datas), 'Json is valid');
}
}

View File

@@ -4,25 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerRootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -46,7 +30,5 @@ class ControllerRootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
/* @var $response \Symfony\Component\HttpFoundation\Response */
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset());
}
}

View File

@@ -1,16 +1,6 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Controller/Prod/Story.php';
use Doctrine\Common\DataFixtures\Loader;
@@ -18,15 +8,8 @@ use PhraseaFixture\Basket as MyFixture;
use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
/**
@@ -190,8 +173,7 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$totalRecords = count($records);
$n = 0;
foreach ($records as $record)
{
foreach ($records as $record) {
/* @var $record \record_adapter */
$route = sprintf(
"/story/%s/%s/delete/%s/%s/"
@@ -201,16 +183,13 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, $record->get_record_id()
);
if (($n % 2) === 0)
{
if (($n % 2) === 0) {
$crawler = $this->client->request('POST', $route);
$response = $this->client->getResponse();
$this->assertEquals(302, $response->getStatusCode());
}
else
{
} else {
$crawler = $this->client->request(
'POST', $route, array(), array(), array(
"HTTP_ACCEPT" => "application/json")
@@ -224,5 +203,4 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals($totalRecords - $n, self::$story_1->get_children()->get_count());
}
}
}

View File

@@ -9,7 +9,6 @@ use Symfony\Component\HttpFoundation\Response;
class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
protected static $need_records = 1;
protected static $need_subdefs = true;
@@ -69,8 +68,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, sprintf($route_base, 'overview')
);
foreach ($routes as $route)
{
foreach ($routes as $route) {
$crawler = $this->client->request('POST', $route);
$pageContent = $this->client->getResponse()->getContent();
$this->assertTrue($this->client->getResponse()->isOk());
@@ -90,8 +88,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, sprintf($route_base, 'overview')
);
foreach ($routes as $route)
{
foreach ($routes as $route) {
$option = new \searchEngine_options();
$crawler = $this->client->request('POST', $route, array('options_serial' => serialize($option)));
@@ -113,8 +110,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$databox = self::$record_1->get_databox();
foreach ($databox->get_meta_structure() as $field)
{
foreach ($databox->get_meta_structure() as $field) {
$route = '/tooltip/metas/FieldInfos/' . $databox->get_sbas_id()
. '/' . $field->get_id() . '/';
@@ -134,22 +130,18 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, databox_field::DCES_DESCRIPTION => new databox_Field_DCES_Description()
);
foreach ($databox->get_meta_structure() as $field)
{
foreach ($databox->get_meta_structure() as $field) {
$dces_element = array_shift($dces);
$field->set_dces_element($dces_element);
$route = '/tooltip/DCESInfos/' . $databox->get_sbas_id()
. '/' . $field->get_id() . '/';
if ($field->get_dces_element() !== null)
{
if ($field->get_dces_element() !== null) {
$crawler = $this->client->request('POST', $route);
$this->assertGreaterThan(0, strlen($this->client->getResponse()->getContent()));
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
}
else
{
} else {
$crawler = $this->client->request('POST', $route);
$this->assertEquals(0, strlen($this->client->getResponse()->getContent()));
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -161,8 +153,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$databox = self::$record_1->get_databox();
foreach ($databox->get_meta_structure() as $field)
{
foreach ($databox->get_meta_structure() as $field) {
$route = '/tooltip/metas/restrictionsInfos/' . $databox->get_sbas_id()
. '/' . $field->get_id() . '/';
@@ -192,5 +183,4 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request('POST', $route);
$this->assertTrue($this->client->getResponse()->isOk());
}
}

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
* For example, this will loacd 2 records
* (self::$record_1 and self::$record_2) :
*
* $need_records = 2;
*
*/
protected static $need_records = false;
/**
* The application loader
*/
public function createApplication()
{
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -73,16 +56,14 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
if ($owners)
$this->assertTrue(count($list->owners) > 0);
foreach ($list->owners as $owner)
{
foreach ($list->owners as $owner) {
$this->checkOwner($owner);
}
if ($users)
$this->assertTrue(count($list->users) > 0);
foreach ($list->users as $user)
{
foreach ($list->users as $user) {
$this->checkUser($user);
}
}
@@ -475,5 +456,4 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertObjectHasAttribute('company', $user);
$this->assertObjectHasAttribute('email', $user);
}
}

View File

@@ -1,28 +1,12 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
protected static $need_records = 1;
protected static $need_story = true;
@@ -209,5 +193,4 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$route = sprintf("/WorkZone/detachStory/%s/%s/", $story->get_sbas_id(), 'unknow');
//story not yet Attched
}
}

View File

@@ -11,7 +11,6 @@ use Symfony\Component\DomCrawler\Crawler;
class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
{
/**
*
* @var Feed_Adapter
@@ -90,16 +89,13 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function tearDown()
{
if (self::$publisher instanceof Feed_Publisher_Adapter)
{
if (self::$publisher instanceof Feed_Publisher_Adapter) {
self::$publisher->delete();
}
if (self::$entry instanceof Feed_Entry_Adapter)
{
if (self::$entry instanceof Feed_Entry_Adapter) {
self::$entry->delete();
}
if (self::$feed instanceof Feed_Adapter)
{
if (self::$feed instanceof Feed_Adapter) {
self::$feed->delete();
}
parent::tearDown();
@@ -129,8 +125,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$publisher = array_shift(self::$feed_4_public->get_publishers());
for ($i = 1; $i != 15; $i++)
{
for ($i = 1; $i != 15; $i ++ ) {
$entry = Feed_Entry_Adapter::create($appbox, self::$feed_4_public, $publisher, 'titre entry', 'soustitre entry', 'Jean-Marie Biggaro', 'author@example.com');
$item = Feed_Entry_Item::create($appbox, $entry, self::$record_1);
$item = Feed_Entry_Item::create($appbox, $entry, self::$record_2);
@@ -241,7 +236,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals('UTF-8', $response->getCharset(), 'Test charset response');
}
//$app->get('/feeds/feed/{id}/{format}/', function($id, $format) use ($app, $appbox, $display_feed)
public function testPublicFeed()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
@@ -262,7 +256,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->evaluateAtom($response);
}
//$app->get('/feeds/userfeed/aggregated/{token}/{format}/', function($token, $format) use ($app, $appbox, $display_feed)
public function testUserFeedAggregated()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
@@ -283,7 +276,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->evaluateAtom($response);
}
//$app->get('/feeds/userfeed/{token}/{id}/{format}/', function($token, $id, $format) use ($app, $appbox, $display_feed)
public function testUserFeed()
{
$appbox = appbox::get_instance(\bootstrap::getCore());
@@ -336,8 +328,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
{
$feeds = Feed_Collection::load_public_feeds(appbox::get_instance(\bootstrap::getCore()));
$all_feeds = $feeds->get_feeds();
foreach ($all_feeds as $feed)
{
foreach ($all_feeds as $feed) {
$this->assertTrue($feed->is_public());
}
$crawler = $this->client->request("GET", "/feeds/aggregated/rss/");
@@ -351,8 +342,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
{
$feeds = Feed_Collection::load_public_feeds(appbox::get_instance(\bootstrap::getCore()));
$all_feeds = $feeds->get_feeds();
foreach ($all_feeds as $feed)
{
foreach ($all_feeds as $feed) {
$this->assertTrue($feed->is_public());
}
$crawler = $this->client->request("GET", "/feeds/aggregated/atom/");
@@ -405,18 +395,14 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
/**
* XML is not verified due to Validator Service bug
*/
return;
try
{
try {
$validator = new W3CFeedRawValidator($xml);
$response = $validator->validate();
$this->assertTrue($response->isValid(), $xml . "\n" . $response);
}
catch (W3CFeedValidatorException $e)
{
} catch (W3CFeedValidatorException $e) {
print "\nCould not use W3C FEED VALIDATOR API : " . $e->getMessage() . "\n";
}
}
@@ -437,12 +423,9 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
function checkRSSRootNode(DOMXPath $xpath, Feed_Adapter $feed)
{
$channel = $xpath->query("/rss/channel");
foreach ($channel->item(0)->childNodes as $child)
{
if ($child->nodeType !== XML_TEXT_NODE)
{
switch ($child->nodeName)
{
foreach ($channel->item(0)->childNodes as $child) {
if ($child->nodeType !== XML_TEXT_NODE) {
switch ($child->nodeName) {
case 'title':
$this->assertEquals($feed->get_title(), $child->nodeValue);
break;
@@ -465,10 +448,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals("http://blogs.law.harvard.edu/tech/rss", $child->nodeValue);
break;
case 'atom:link':
foreach ($child->attributes as $attribute)
{
if ($attribute->name == "href")
{
foreach ($child->attributes as $attribute) {
if ($attribute->name == "href") {
$this->assertEquals($feed->get_homepage_link(registry::get_instance(), Feed_Adapter::FORMAT_RSS, 1)->get_href(), $attribute->value);
break;
}
@@ -488,10 +469,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries();
foreach ($list_entries as $node)
{
if (sizeof($entries) == 0)
{
foreach ($list_entries as $node) {
if (sizeof($entries) == 0) {
$offset_start = ($offset_start ++ ) * $n_entries;
$collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries();
@@ -499,8 +478,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
break;
}
$feed_entry = array_shift($entries);
switch ($node->nodeName)
{
switch ($node->nodeName) {
case 'title':
$this->assertEquals($feed_entry->get_title(), $node->nodeValue);
break;
@@ -539,8 +517,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$media_group = $xpath->query("/rss/channel/item[" . $count . "]/media:group");
$this->assertEquals(sizeof($content), $media_group->length);
foreach ($media_group as $media)
{
foreach ($media_group as $media) {
$entry_item = array_shift($content);
$this->verifyMediaItem($entry_item, $media);
}
@@ -548,12 +525,9 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function verifyMediaItem(Feed_Entry_Item $item, DOMNode $node)
{
foreach ($node->childNodes as $node)
{
if ($node->nodeType !== XML_TEXT_NODE)
{
switch ($node->nodeName)
{
foreach ($node->childNodes as $node) {
if ($node->nodeType !== XML_TEXT_NODE) {
switch ($node->nodeName) {
case 'media:content' :
$this->checkMediaContentAttributes($item, $node);
break;
@@ -569,8 +543,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function parseAttributes(DOMNode $node)
{
$current_attributes = array();
foreach ($node->attributes as $attribute)
{
foreach ($node->attributes as $attribute) {
$current_attributes[$attribute->name] = $attribute->value;
}
@@ -583,22 +556,17 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$is_thumbnail = false;
$record = $entry_item->get_record();
if (substr($current_attributes["url"], 0 - strlen("/preview/")) == "/preview/")
{
if (substr($current_attributes["url"], 0 - strlen("/preview/")) == "/preview/") {
$ressource = $record->get_subdef('preview');
}
else
{
} else {
$ressource = $record->get_thumbnail();
$is_thumbnail = true;
}
$permalink = $ressource->get_permalink();
foreach ($current_attributes as $attribute => $value)
{
switch ($attribute)
{
foreach ($current_attributes as $attribute => $value) {
switch ($attribute) {
case "url":
$this->assertEquals($permalink->get_url(), $value);
break;
@@ -714,25 +682,18 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
);
foreach ($fields as $key_field => $field)
{
if ($field["media_field"]["name"] == $node->nodeName)
{
if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"]))
{
foreach ($fields as $key_field => $field) {
if ($field["media_field"]["name"] == $node->nodeName) {
if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"])) {
$this->assertEquals($p4field->get_serialized_values($field["separator"]), $node->nodeValue
, sprintf('Asserting good value for DC %s', $field["dc_field"]));
if (sizeof($field["media_field"]["attributes"]) > 0)
{
foreach ($node->attributes as $attribute)
{
if (sizeof($field["media_field"]["attributes"]) > 0) {
foreach ($node->attributes as $attribute) {
$this->assertTrue(array_key_exists($attribute->name, $field["media_field"]["attributes"]), "Checkin attribute " . $attribute->name . " for " . $field['media_field']['name']);
$this->assertEquals($attribute->value, $field["media_field"]["attributes"][$attribute->name], "Checkin attribute " . $attribute->name . " for " . $field['media_field']['name']);
}
}
}
else
{
} else {
$this->fail("Missing media:entry");
}
break;
@@ -742,20 +703,17 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function removeBadItems(Array &$item_entries, Array $available_medium)
{
$remove = function($entry_item, $key) use (&$item_entries, $available_medium)
{
$remove = function($entry_item, $key) use (&$item_entries, $available_medium) {
$preview_sd = $entry_item->get_record()->get_subdef('preview');
$url_preview = $preview_sd->get_permalink();
$thumbnail_sd = $entry_item->get_record()->get_thumbnail();
$url_thumb = $thumbnail_sd->get_permalink();
if (!in_array(strtolower($entry_item->get_record()->get_type()), $available_medium))
{
if ( ! in_array(strtolower($entry_item->get_record()->get_type()), $available_medium)) {
unset($item_entries[$key]); //remove
}
if (!$url_thumb || !$url_preview)
{
if ( ! $url_thumb || ! $url_preview) {
unset($item_entries[$key]); //remove
}
};
@@ -799,10 +757,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries();
foreach ($entries_item as $entry)
{
if (sizeof($entries) == 0)
{
foreach ($entries_item as $entry) {
if (sizeof($entries) == 0) {
$offset_start = ($offset_start ++ ) * $n_entries;
$collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries();
@@ -818,20 +774,15 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function checkATOMEntryNode(DOMNode $node, DOMXPath $xpath, Feed_Adapter $feed, Feed_Entry_Adapter $entry)
{
foreach ($node->childNodes as $child)
{
if ($child->nodeType !== XML_TEXT_NODE)
{
switch ($child->nodeName)
{
foreach ($node->childNodes as $child) {
if ($child->nodeType !== XML_TEXT_NODE) {
switch ($child->nodeName) {
case 'id':
$this->assertEquals(sprintf('%sentry/%d/', $feed->get_homepage_link(registry::get_instance(), Feed_Adapter::FORMAT_ATOM, 1)->get_href(), $entry->get_id()), $child->nodeValue);
break;
case 'link':
foreach ($child->attributes as $attribute)
{
if ($attribute->name == "href")
{
foreach ($child->attributes as $attribute) {
if ($attribute->name == "href") {
$this->assertEquals(sprintf('%sentry/%d/', $feed->get_homepage_link(registry::get_instance(), Feed_Adapter::FORMAT_ATOM, 1)->get_href(), $entry->get_id()), $attribute->value);
break;
}
@@ -850,8 +801,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals($entry->get_subtitle(), $child->nodeValue);
break;
case 'author':
foreach ($node->childNodes as $child)
{
foreach ($node->childNodes as $child) {
if ($child->nodeType !== XML_TEXT_NODE && $child->nodeName == "email")
$this->assertEquals($entry->get_author_email(), $child->nodeValue);
if ($child->nodeType !== XML_TEXT_NODE && $child->nodeName == "name")
@@ -872,18 +822,14 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$media_group = $xpath->query("/Atom:feed/Atom:entry[0]/media:group");
if ($media_group->length > 0)
{
foreach ($media_group as $media)
{
if ($media_group->length > 0) {
foreach ($media_group as $media) {
$entry_item = array_shift($content);
if ($entry_item instanceof Feed_Entry_Item)
{
if ($entry_item instanceof Feed_Entry_Item) {
$this->verifyMediaItem($entry_item, $media);
}
}
}
}
}

View File

@@ -7,17 +7,14 @@ use Symfony\Component\HttpFoundation\Request;
use Alchemy\Phrasea\Controller\Setup as Controller;
use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
return call_user_func(function()
{
return call_user_func(function() {
$app = new \Silex\Application();
$app['Core'] = \bootstrap::getCore();
$app['install'] = true;
$app->get('/', function() use ($app)
{
$app->get('/', function() use ($app) {
return $app->redirect('/setup/installer/');
});

View File

@@ -7,17 +7,14 @@ use Symfony\Component\HttpFoundation\Request;
use Alchemy\Phrasea\Controller\Setup as Controller;
use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
return call_user_func(function()
{
return call_user_func(function() {
$app = new \Silex\Application();
$app['Core'] = \bootstrap::getCore();
$app['upgrade'] = true;
$app->get('/', function() use ($app)
{
$app->get('/', function() use ($app) {
return $app->redirect('/setup/upgrader/');
});
@@ -27,6 +24,7 @@ return call_user_func(function()
$app->error(function($e) {
});

View File

@@ -4,11 +4,11 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAbstract.class.inc';
class ControllerInstallerTest extends \PhraseanetWebTestCaseAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
@@ -69,5 +69,4 @@ class ControllerInstallerTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals(200, $response->getStatusCode());
$this->assertTrue($response->isOk());
}
}

View File

@@ -4,11 +4,11 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAbstract.class.inc';
class ControllerUpgraderTest extends \PhraseanetWebTestCaseAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
protected $client;
/**
* If the controller tests require some records, specify it her
*
@@ -60,6 +60,7 @@ class ControllerUpgraderTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals(200, $response->getStatusCode());
}
/**
* Default route test
*/
@@ -72,6 +73,7 @@ class ControllerUpgraderTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals(200, $response->getStatusCode());
}
/**
* Default route test
*/
@@ -84,5 +86,4 @@ class ControllerUpgraderTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals(302, $response->getStatusCode());
$this->assertEquals('/', $response->headers->get('location'));
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAbstract.class.inc';
class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
@@ -118,6 +117,5 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
$this->assertObjectHasAttribute('is_databox', $content);
$this->assertFalse($content->database);
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAbstract.class.inc';
class ControllerPathFileTestTest extends \PhraseanetWebTestCaseAbstract
{
/**
* As controllers use WebTestCase, it requires a client
*/
@@ -65,5 +64,4 @@ class ControllerPathFileTestTest extends \PhraseanetWebTestCaseAbstract
$content = json_decode($this->client->getResponse()->getContent());
$this->assertTrue(is_object($content));
}
}

View File

@@ -1,28 +1,12 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
use Alchemy\Phrasea\Core as PhraseaCore;
use Alchemy\Phrasea\Core\Configuration;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ConfigurationTest extends \PhraseanetPHPUnitAbstract
{
/**
*
* @var \Alchemy\Phrasea\Core\Configuration
@@ -109,13 +93,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
$this->confNotInstalled->setEnvironnement("prod");
$this->assertEquals("prod", $this->confNotInstalled->getEnvironnement());
try
{
try {
$this->object->setEnvironnement("unknow");
$this->fail("should raise exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -165,13 +146,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
$this->object->setEnvironnement("prod");
$this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag", $this->object->getPhraseanet());
$this->object->setEnvironnement("missing_phraseanet");
try
{
try {
$this->object->getPhraseanet();
$this->fail("should raise an exeception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -207,13 +185,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetConnexionException()
{
try
{
try {
$this->object->getConnexion('unknow_connexion');
$this->fail('should raise an exception');
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -225,13 +200,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetFileExeption()
{
try
{
try {
$this->assertInstanceOf("\SplFileObject", $this->confNotInstalled->getFile());
$this->fail("should raise an excpetion");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -262,13 +234,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetServiceException()
{
try
{
try {
$this->object->getService('unknow_service');
$this->fail('should raise an exception');
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -340,13 +309,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
)
);
try
{
try {
$configuration->write($arrayToBeWritten);
$this->fail("should raise an exception");
}
catch (\exception $e)
{
} catch (\exception $e) {
}
}
@@ -398,13 +364,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
$configuration = new PhraseaCore\Configuration($handler);
try
{
try {
$configuration->delete();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
@@ -415,12 +378,9 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetTemplating()
{
try
{
try {
$templating = $this->object->getTemplating();
}
catch (\Exception $e)
{
} catch (\Exception $e) {
$this->fail("not template_engine provided");
}
$this->assertTrue(is_string($templating));
@@ -428,12 +388,9 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetOrm()
{
try
{
try {
$orm = $this->object->getOrm();
}
catch (\Exception $e)
{
} catch (\Exception $e) {
$this->fail("not template_engine provided");
}
$this->assertTrue(is_string($orm));
@@ -479,13 +436,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
//append new conf
$configuration->write($newScope, FILE_APPEND);
try
{
try {
$configuration->getConfiguration(); //it is not loaded
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
@@ -495,6 +449,5 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
unlink(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
{
@@ -26,20 +11,14 @@ class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
if (extension_loaded('apc'))
{
if (extension_loaded('apc')) {
$service = $cache->getDriver();
$this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider);
}
else
{
try
{
} else {
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -51,13 +30,10 @@ class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
try
{
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -70,5 +46,4 @@ class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("apc", $cache->getType());
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceArrayCacheTest extends PhraseanetPHPUnitAbstract
{
@@ -36,13 +21,10 @@ class ServiceArrayCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
try
{
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -55,5 +37,4 @@ class ServiceArrayCacheTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("array", $cache->getType());
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
{
@@ -26,20 +11,14 @@ class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
if (extension_loaded('memcache'))
{
if (extension_loaded('memcache')) {
$service = $cache->getDriver();
$this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider);
}
else
{
try
{
} else {
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -51,13 +30,10 @@ class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
try
{
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -88,5 +64,4 @@ class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
$this->assertEquals(\Alchemy\Phrasea\Core\Service\Cache\MemcacheCache::DEFAULT_PORT, $cache->getPort());
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
{
@@ -26,20 +11,14 @@ class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
if (extension_loaded('xcache'))
{
if (extension_loaded('xcache')) {
$service = $cache->getDriver();
$this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider);
}
else
{
try
{
} else {
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch(\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -51,13 +30,10 @@ class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array()
);
try
{
try {
$cache->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -70,5 +46,4 @@ class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("xcache", $cache->getType());
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrineMonologTest extends PhraseanetPHPUnitAbstract
{
protected $options = array(
"handler" => "rotate"
, "filename" => "test"
@@ -27,11 +11,6 @@ class DoctrineMonologTest extends PhraseanetPHPUnitAbstract
, 'channel' => 'test'
);
public function setUp()
{
parent::setUp();
}
public function testService()
{
@@ -53,19 +32,15 @@ class DoctrineMonologTest extends PhraseanetPHPUnitAbstract
public function testExceptionBadOutput()
{
try
{
try {
$this->options["output"] = "unknowOutput";
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Monolog(
self::$core, $this->options
);
$log->getDriver();
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
}

View File

@@ -1,28 +1,12 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrinePhpechoTest extends PhraseanetPHPUnitAbstract
{
public function testService()
{
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Phpecho(
self::$core, array()
);
@@ -38,5 +22,4 @@ class DoctrinePhpechoTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("phpecho", $log->getType());
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class MonologTest extends PhraseanetPHPUnitAbstract
{
protected $options;
public function setUp()
@@ -32,7 +16,6 @@ class MonologTest extends PhraseanetPHPUnitAbstract
);
}
public function testService()
{
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
@@ -53,63 +36,51 @@ class MonologTest extends PhraseanetPHPUnitAbstract
public function testExceptionMissingOptions()
{
try
{
try {
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
public function testExceptionMissingHandler()
{
try
{
try {
unset($this->options["handler"]);
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
public function testExceptionUnknowHandler()
{
try
{
try {
$this->options["handler"] = "unknowHandler";
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
public function testMissingFile()
{
try
{
try {
unset($this->options["filename"]);
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -123,5 +94,4 @@ class MonologTest extends PhraseanetPHPUnitAbstract
);
$this->assertInstanceOf("\Monolog\Logger", $log->getDriver());
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrineTest extends PhraseanetPHPUnitAbstract
{
protected $options;
public function setUp()
@@ -57,15 +41,12 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
public function testExceptionMissingOptions()
{
try
{
try {
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -78,8 +59,7 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
self::$core, $this->options
);
foreach ($doctrine->getCacheServices()->all() as $service)
{
foreach ($doctrine->getCacheServices()->all() as $service) {
$this->assertEquals("array", $service->getType());
}
}
@@ -88,15 +68,12 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
{
$this->options["cache"]["result"] = "unknowCache";
try
{
try {
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->fail("An exception should be raised");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -126,8 +103,7 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
$this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag"
, $doctrine->getCacheServices());
foreach ($doctrine->getCacheServices()->all() as $service)
{
foreach ($doctrine->getCacheServices()->all() as $service) {
$this->assertEquals("array", $service->getType());
}
@@ -137,16 +113,14 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
, "result" => "xcache_cache"
);
if (extension_loaded("apc") && extension_loaded("xcache"))
{
if (extension_loaded("apc") && extension_loaded("xcache")) {
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag"
, $doctrine->getCacheServices());
foreach ($doctrine->getCacheServices()->all() as $key => $service)
{
foreach ($doctrine->getCacheServices()->all() as $key => $service) {
if ($key === "metadata")
$this->assertEquals("array", $service->getType());
elseif ($key === "query")
@@ -155,17 +129,13 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("xcache", $service->getType());
}
}
else
{
try
{
else {
try {
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->fail("An exception should be raised");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -173,50 +143,40 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
public function testExceptionUnknowLogService()
{
try
{
try {
$this->options["log"] = "unknowLogger";
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
public function testExceptionMissingDbal()
{
try
{
try {
unset($this->options["dbal"]);
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
public function testExceptionUnknowDbal()
{
try
{
try {
$this->options["dbal"] = "unknowDbal";
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceAbstractTest extends PhraseanetPHPUnitAbstract
{
/**
*
* @var \Alchemy\Phrasea\Core\Service\ServiceAbstract
@@ -45,5 +29,4 @@ class ServiceAbstractTest extends PhraseanetPHPUnitAbstract
$this->assertTrue(is_array($this->object->getOptions()));
$this->assertEquals(array('option' => 'my_options'), $this->object->getOptions());
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class TwigTest extends PhraseanetPHPUnitAbstract
{
protected $options;
public function setUp()
@@ -60,5 +44,4 @@ class TwigTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("twig", $doctrine->getType());
}
}

View File

@@ -1,29 +1,13 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class AbstractBuilderTest extends PhraseanetPHPUnitAbstract
{
public function testConstructExceptionNameEmpty()
{
try
{
try {
$stub = $this->getMock(
"\Alchemy\Phrasea\Core\Service\Builder"
, array(
@@ -33,17 +17,14 @@ class AbstractBuilderTest extends PhraseanetPHPUnitAbstract
)
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
public function testConstructExceptionCreate()
{
try
{
try {
$stub = $this->getMock(
"\\Alchemy\\Phrasea\\Core\\Service\\Builder"
, array(
@@ -53,11 +34,8 @@ class AbstractBuilderTest extends PhraseanetPHPUnitAbstract
)
);
$this->fail("should raise an exception");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class CacheBuilderTest extends PhraseanetPHPUnitAbstract
{
@@ -26,13 +11,10 @@ class CacheBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow")
);
try
{
try {
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -46,5 +28,4 @@ class CacheBuilderTest extends PhraseanetPHPUnitAbstract
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class LogBuilderTest extends PhraseanetPHPUnitAbstract
{
@@ -26,13 +11,10 @@ class LogBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow", "options" => array())
);
try
{
try {
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -63,5 +45,4 @@ class LogBuilderTest extends PhraseanetPHPUnitAbstract
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class OrmBuilderTest extends PhraseanetPHPUnitAbstract
{
@@ -26,13 +11,10 @@ class OrmBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow", "options" => array())
);
try
{
try {
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -58,5 +40,4 @@ class OrmBuilderTest extends PhraseanetPHPUnitAbstract
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
}
}

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class TemplateBuilderTest extends PhraseanetPHPUnitAbstract
{
@@ -26,13 +11,10 @@ class TemplateBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow", "options" => array())
);
try
{
try {
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised");
}
catch (\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -54,5 +36,4 @@ class TemplateBuilderTest extends PhraseanetPHPUnitAbstract
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
}
}

View File

@@ -1,24 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
use Alchemy\Phrasea\Core\Version;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class VersionTest extends \PhraseanetPHPUnitAbstract
{

View File

@@ -1,22 +1,7 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class CoreTest extends PhraseanetPHPUnitAbstract
{
@@ -107,8 +92,7 @@ class CoreTest extends PhraseanetPHPUnitAbstract
public function testNotInstalled()
{
if (!extension_loaded('test_helpers'))
{
if ( ! extension_loaded('test_helpers')) {
$this->markTestSkipped("test_helpers extension required");
}
@@ -136,11 +120,9 @@ class CoreTest extends PhraseanetPHPUnitAbstract
protected function newCallback($className)
{
switch ($className)
{
switch ($className) {
case 'Alchemy\Phrasea\Core\Configuration': return 'ConfMock';
default: return $className;
}
}
}

View File

@@ -1,26 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperBridgeTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Bridge
*/
protected $object;
public function setUp()
{
parent::setUp();
}
public function testFooBar()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,138 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperEditTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Edit
*/
protected $object;
public function setUp()
{
parent::setUp();
}
/**
*
* @todo Implement testPropose_editing().
*/
public function testPropose_editing()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testHas_thesaurus().
*/
public function testHas_thesaurus()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_javascript_elements_ids().
*/
public function testGet_javascript_elements_ids()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_javascript_elements().
*/
public function testGet_javascript_elements()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_javascript_sugg_values().
*/
public function testGet_javascript_sugg_values()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_javascript_status().
*/
public function testGet_javascript_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_javascript_fields().
*/
public function testGet_javascript_fields()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_status().
*/
public function testGet_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_fields().
*/
public function testGet_fields()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testExecute().
*/
public function testExecute()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,26 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperFeedTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Feed
*/
protected $object;
public function setUp()
{
parent::setUp();
}
public function testFooBar()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,186 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperHelperTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Helper
*/
protected $object;
public function setUp()
{
parent::setUp();
}
/**
*
* @todo Implement testIs_basket().
*/
public function testIs_basket()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_original_basket().
*/
public function testGet_original_basket()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testIs_single_grouping().
*/
public function testIs_single_grouping()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_grouping_head().
*/
public function testGet_grouping_head()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_elements().
*/
public function testGet_elements()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testHas_many_sbas().
*/
public function testHas_many_sbas()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testIs_possible().
*/
public function testIs_possible()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_count_not_actionable().
*/
public function testGet_count_not_actionable()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_count_actionable().
*/
public function testGet_count_actionable()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_count_actionable_groupings().
*/
public function testGet_count_actionable_groupings()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_count_element_received().
*/
public function testGet_count_element_received()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_sbas_id().
*/
public function testGet_sbas_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_serialize_list().
*/
public function testGet_serialize_list()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGrep_records().
*/
public function testGrep_records()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,54 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperMoveCollectionTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var MoveCollection
*/
protected $object;
public function setUp()
{
parent::setUp();
}
/**
*
* @todo Implement testAvailable_destination().
*/
public function testAvailable_destination()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testPropose().
*/
public function testPropose()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testExecute().
*/
public function testExecute()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,42 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperPrinterTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Printer
*/
protected $object;
public function setUp()
{
parent::setUp();
}
/**
*
* @todo Implement testGet_count_preview().
*/
public function testGet_count_preview()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
*
* @todo Implement testGet_count_thumbnail().
*/
public function testGet_count_thumbnail()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,31 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperPushTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Push
*/
protected $object;
public function setUp()
{
parent::setUp();
}
/**
*
* @todo Implement testSearch().
*/
public function testSearch()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,26 +0,0 @@
<?php
require_once __DIR__ . '/../../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
class HelperTooltipTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{
/**
* @var Tooltip
*/
protected $object;
public function setUp()
{
parent::setUp();
}
public function testFooBar()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -40,5 +40,4 @@ class AutoloaderTest extends \PhraseanetPHPUnitAbstract
$this->assertArrayHasKey('config', $autoloader->getPaths());
$this->assertArrayHasKey('library', $autoloader->getPaths());
}
}

View File

@@ -1,25 +1,9 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
{
private $apc = false;
private $xcache = false;
@@ -27,28 +11,22 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
{
parent::setUp();
if (extension_loaded('apc'))
{
if (extension_loaded('apc')) {
$this->apc = true;
}
if (extension_loaded('xcache'))
{
if (extension_loaded('xcache')) {
$this->xcache = true;
}
}
public function testConstruct()
{
if (!$this->apc && !$this->xcache)
{
try
{
if ( ! $this->apc && ! $this->xcache) {
try {
$autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_');
$this->fail("should raise an exception");
}
catch(\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -56,14 +34,10 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testFindFileApc()
{
if ($this->apc)
{
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli')))
{
if ($this->apc) {
if ( ! (ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
$this->markTestSkipped('The apc extension is available, but not enabled.');
}
else
{
} else {
apc_clear_cache('user');
}
@@ -75,8 +49,7 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testGetPrefix()
{
if ($this->apc)
{
if ($this->apc) {
$autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_');
$this->assertEquals('test_prefix_', $autoloader->getPrefix());
}
@@ -84,14 +57,10 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testRegister()
{
if ($this->apc)
{
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli')))
{
if ($this->apc) {
if ( ! (ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
$this->markTestSkipped('The apc extension is available, but not enabled.');
}
else
{
} else {
apc_clear_cache('user');
}
$autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_');
@@ -103,19 +72,16 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testFindFileXcache()
{
if ($this->xcache)
{
if ($this->xcache) {
$this->marktestSkipped("can't use xcache in cli mode");
}
}
public function tearDown()
{
if (ini_get('apc.enabled') && ini_get('apc.enable_cli'))
{
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
apc_clear_cache('user');
}
parent::tearDown();
}
}

View File

@@ -1,21 +1,5 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Test_hello
{

View File

@@ -1,21 +1,5 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class HelloCache
{

View File

@@ -1,21 +1,5 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Test_test
{

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class AudioTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Audio
*/
@@ -38,5 +37,4 @@ class AudioTest extends \PHPUnit_Framework_TestCase
{
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Audio', $this->object->getMediaAlchemystSpec());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class FlexPaperTest extends \PHPUnit_Framework_TestCase
{
/**
* @var FlexPaper
*/
@@ -38,5 +37,4 @@ class FlexPaperTest extends \PHPUnit_Framework_TestCase
{
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Flash', $this->object->getMediaAlchemystSpec());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class GifTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Gif
*/
@@ -38,5 +37,4 @@ class GifTest extends \PHPUnit_Framework_TestCase
{
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Animation', $this->object->getMediaAlchemystSpec());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class ImageTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Image
*/
@@ -38,5 +37,4 @@ class ImageTest extends \PHPUnit_Framework_TestCase
{
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Image', $this->object->getMediaAlchemystSpec());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef\OptionType;
class BooleanTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Boolean
*/
@@ -49,5 +48,4 @@ class BooleanTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals('Booleen', $this->object->getDisplayName());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef\OptionType;
class EnumTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Enum
*/
@@ -68,5 +67,4 @@ class EnumTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals('Numo', $this->object->getDisplayName());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef\OptionType;
class RangeTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Range
*/
@@ -88,5 +87,4 @@ class RangeTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals('Rangers', $this->object->getDisplayName());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class ProviderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Provider
*/
@@ -22,8 +21,7 @@ class ProviderTest extends \PHPUnit_Framework_TestCase
{
$this->assertTrue(is_array($this->object->getOptions()));
foreach ($this->object->getOptions() as $option)
{
foreach ($this->object->getOptions() as $option) {
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType', $option);
}
}
@@ -48,5 +46,4 @@ class ProviderTest extends \PHPUnit_Framework_TestCase
$option = $this->object->getOption(Image::OPTION_SIZE);
$this->assertEquals(300, $option->getValue());
}
}

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class VideoTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Video
*/
@@ -38,5 +37,4 @@ class VideoTest extends \PHPUnit_Framework_TestCase
{
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Video', $this->object->getMediaAlchemystSpec());
}
}

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
class UserProviderTest extends \PhraseanetPHPUnitAbstract
{
/**
* @var UserProvider
*/
@@ -12,6 +11,7 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
$this->object = new \Alchemy\Phrasea\Vocabulary\ControlProvider\UserProvider();
}
@@ -65,27 +65,20 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
public function testGetValue()
{
try
{
try {
$this->object->getValue(-200);
$this->fail('Should raise an exception');
}
catch(\Exception $e)
{
} catch (\Exception $e) {
}
try
{
try {
$this->object->getValue('A');
$this->fail('Should raise an exception');
}
catch(\Exception $e)
{
} catch (\Exception $e) {
}
$this->assertEquals(self::$user->get_display_name(), $this->object->getValue(self::$user->get_id()));
}
}

View File

@@ -11,13 +11,10 @@ class ControllerTest extends \PhraseanetPHPUnitAbstract
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\UserProvider', $provider);
try
{
try {
$provider = \Alchemy\Phrasea\Vocabulary\Controller::get('Zebulon');
$this->fail('Should raise an exception');
}
catch(\Exception $e)
{
} catch (\Exception $e) {
}
}
@@ -28,10 +25,8 @@ class ControllerTest extends \PhraseanetPHPUnitAbstract
$this->assertTrue(is_array($available));
foreach($available as $controller)
{
foreach ($available as $controller) {
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\ControlProviderInterface', $controller);
}
}
}

View File

@@ -6,7 +6,6 @@ use \Alchemy\Phrasea\Vocabulary\Term;
class TermTest extends \PhraseanetPHPUnitAbstract
{
/**
* @var Term
*/
@@ -32,6 +31,7 @@ class TermTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
$this->control = new Alchemy\Phrasea\Vocabulary\ControlProvider\UserProvider();
$this->object = new Term($this->value, $this->context);
@@ -66,5 +66,4 @@ class TermTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals(null, $this->object->getId());
$this->assertEquals($this->id, $this->objectWithControl->getId());
}
}

View File

@@ -13,5 +13,4 @@ class Bridge_Api_Auth_AbstractTest extends PHPUnit_Framework_TestCase
$return = $stub->set_settings($setting);
$this->assertEquals($stub, $return);
}
}

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../Bridge_datas.inc';
class Bridge_Api_Auth_FlickrTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Auth_Flickr
*/
@@ -172,5 +171,4 @@ class Bridge_Api_Auth_FlickrTest extends PHPUnit_Framework_TestCase
$this->assertEquals("une_super_url", $stub->get_auth_url());
$this->assertEquals("une_super_url", $stub->get_auth_url($params));
}
}

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../Bridge_datas.inc';
class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Auth_OAuth2
*/
@@ -27,7 +26,6 @@ class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
);
}
public function testParse_request_token()
{
$this->object->set_parameters($this->parameters);
@@ -138,5 +136,4 @@ class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
$more_params = array("response_type" => "test");
$this->assertNotEquals($expected_url, $this->object->get_auth_url($more_params));
}
}

View File

@@ -5,29 +5,11 @@ require_once __DIR__ . '/../Bridge_datas.inc';
class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_AbstractCollection
*/
protected $object;
public function setUp()
{
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
}
/**
* @todo Implement testGet_total_items().
*/
public function testGet_total_items()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -36,9 +18,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $stub->get_total_items());
}
/**
* @todo Implement testSet_total_items().
*/
public function testSet_total_items()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -48,9 +27,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals($return, $stub);
}
/**
* @todo Implement testGet_items_per_page().
*/
public function testGet_items_per_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -59,9 +35,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $stub->get_items_per_page());
}
/**
* @todo Implement testSet_items_per_page().
*/
public function testSet_items_per_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -71,9 +44,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals($return, $stub);
}
/**
* @todo Implement testGet_current_page().
*/
public function testGet_current_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -82,9 +52,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $stub->get_current_page());
}
/**
* @todo Implement testSet_current_page().
*/
public function testSet_current_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -96,9 +63,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $stub->get_current_page());
}
/**
* @todo Implement testGet_total_page().
*/
public function testGet_total_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -107,9 +71,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $stub->get_total_page());
}
/**
* @todo Implement testSet_total_page().
*/
public function testSet_total_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -121,9 +82,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $stub->get_total_page());
}
/**
* @todo Implement testHas_next_page().
*/
public function testHas_next_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -138,9 +96,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertFalse($stub->has_next_page());
}
/**
* @todo Implement testHas_previous_page().
*/
public function testHas_previous_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -152,9 +107,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertFalse($stub->has_previous_page());
}
/**
* @todo Implement testHas_more_than_one_page().
*/
public function testHas_more_than_one_page()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -166,14 +118,10 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertFalse($stub->has_more_than_one_page());
}
/**
* @todo Implement testGet_elements().
*/
public function testGet_elements()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $stub->get_elements());
$this->assertEquals(array(), $stub->get_elements());
}
}

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../Bridge_datas.inc';
class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{
public static $account = null;
public static $api = null;
@@ -16,51 +15,35 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
public function setUp()
{
parent::setUp();
$this->auth = $this->getMock("Bridge_Api_Auth_Interface");
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
}
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
try
{
try {
self::$api = Bridge_Api::get_by_api_name(appbox::get_instance(\bootstrap::getCore()), 'apitest');
}
catch (Bridge_Exception_ApiNotFound $e)
{
} catch (Bridge_Exception_ApiNotFound $e) {
self::$api = Bridge_Api::create(appbox::get_instance(\bootstrap::getCore()), 'apitest');
}
try
{
try {
self::$account = Bridge_Account::load_account_from_distant_id(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo');
}
catch (Bridge_Exception_AccountNotFound $e)
{
} catch (Bridge_Exception_AccountNotFound $e) {
self::$account = Bridge_Account::create(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo', 'coucou');
}
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
self::$api->delete();
if (self::$account instanceof Bridge_Account)
if (self::$account instanceof Bridge_Account) {
self::$account->delete();
}
parent::tearDownAfterClass();
}
/**
* @todo Implement testSet_auth_settings().
*/
public function testSet_auth_settings()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -75,9 +58,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals($stub, $return);
}
/**
* @todo Implement testConnect().
*/
public function testConnectGood()
{
$stub = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -111,9 +91,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$stub->connect();
}
/**
* @todo Implement testReconnect().
*/
public function testReconnect()
{
$stub = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -130,9 +107,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals($stub, $return);
}
/**
* @todo Implement testReconnect().
*/
public function testReconnectBad()
{
$stub = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -146,9 +120,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$stub->reconnect();
}
/**
* @todo Implement testDisconnect().
*/
public function testDisconnect()
{
$stub = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -165,9 +136,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals($stub, $return);
}
/**
* @todo Implement testDisconnect().
*/
public function testDisconnectBad()
{
$stub = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -181,9 +149,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$stub->disconnect();
}
/**
* @todo Implement testIs_connected().
*/
public function testIs_connected()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -197,9 +162,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(TRUE, $return);
}
/**
* @todo Implement testGet_auth_url().
*/
public function testGet_auth_url()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -214,9 +176,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals("une url", $return);
}
/**
* @todo Implement testSet_locale().
*/
public function testSet_locale()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -226,9 +185,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals("fr", $stub->get_locale());
}
/**
* @todo Implement testIs_valid_object_id().
*/
public function testIs_valid_object_id()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -240,9 +196,6 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertFalse($stub->is_valid_object_id(true));
}
/**
* @todo Implement testHandle_exception().
*/
public function testHandle_exception()
{
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
@@ -250,5 +203,4 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$void = $stub->handle_exception($e);
$this->assertNull($void);
}
}

View File

@@ -5,17 +5,16 @@ require_once __DIR__ . '/../Bridge_datas.inc';
class Bridge_Api_ContainerCollectionTest extends PHPUnit_Framework_TestCase
{
public function testAdd_element()
{
$collection = new Bridge_Api_ContainerCollection();
$i = 0;
while($i < 5)
{
while ($i < 5) {
$container = $this->getMock("Bridge_Api_ContainerInterface");
$collection->add_element(new $container);
$i ++;
}
$this->assertEquals(5, sizeof($collection->get_elements()));
}
}

View File

@@ -1,348 +0,0 @@
<?php
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../Bridge_datas.inc';
require_once __DIR__ . '/../../../lib/classes/Bridge/Api/Dailymotion.class.php';
class Bridge_Api_DailymotionTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Dailymotion
*/
protected $object;
protected function setUp()
{
$this->object = $this->getMock("Bridge_Api_Dailymotion", array("initialize_transport", "set_auth_params"), array(registry::get_instance(), $this->getMock("Bridge_Api_Auth_Interface")));
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @todo Implement testConnect().
*/
public function testConnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReconnect().
*/
public function testReconnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_user_id().
*/
public function testGet_user_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_user_name().
*/
public function testGet_user_name()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_name().
*/
public function testGet_name()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_icon_url().
*/
public function testGet_icon_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_image_url().
*/
public function testGet_image_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_url().
*/
public function testGet_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_infos().
*/
public function testGet_infos()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_default_element_type().
*/
public function testGet_default_element_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_default_container_type().
*/
public function testGet_default_container_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_types().
*/
public function testGet_element_types()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_container_types().
*/
public function testGet_container_types()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_object_class_from_type().
*/
public function testGet_object_class_from_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testList_elements().
*/
public function testList_elements()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testList_containers().
*/
public function testList_containers()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpdate_element().
*/
public function testUpdate_element()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testCreate_container().
*/
public function testCreate_container()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testAdd_element_to_container().
*/
public function testAdd_element_to_container()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testDelete_object().
*/
public function testDelete_object()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testAcceptable_records().
*/
public function testAcceptable_records()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_status().
*/
public function testGet_element_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testMap_connector_to_element_status().
*/
public function testMap_connector_to_element_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_error_message_from_status().
*/
public function testGet_error_message_from_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testHandle_exception().
*/
public function testHandle_exception()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpload().
*/
public function testUpload()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_from_id().
*/
public function testGet_element_from_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_container_from_id().
*/
public function testGet_container_from_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_category_list().
*/
public function testGet_category_list()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -10,13 +10,11 @@ class Bridge_Api_ElementCollectionTest extends PHPUnit_Framework_TestCase
{
$collection = new Bridge_Api_ElementCollection();
$i = 0;
while($i < 5)
{
while ($i < 5) {
$element = $this->getMock("Bridge_Api_ElementInterface");
$collection->add_element(new $element);
$i ++;
}
$this->assertEquals(5, sizeof($collection->get_elements()));
}
}

View File

@@ -1,336 +0,0 @@
<?php
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../Bridge_datas.inc';
class Bridge_Api_FlickrTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Flickr
*/
protected $object;
public function setUp()
{
$this->object = $this->getMock("Bridge_Api_Flickr", array("initialize_transport", "set_auth_params"), array(registry::get_instance(), $this->getMock("Bridge_Api_Auth_Interface")));
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
}
/**
* @todo Implement testConnect().
*/
public function testConnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testDisconnect().
*/
public function testDisconnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_user_name().
*/
public function testGet_user_name()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_user_id().
*/
public function testGet_user_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_name().
*/
public function testGet_name()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_icon_url().
*/
public function testGet_icon_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_image_url().
*/
public function testGet_image_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_url().
*/
public function testGet_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_infos().
*/
public function testGet_infos()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_default_element_type().
*/
public function testGet_default_element_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_default_container_type().
*/
public function testGet_default_container_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_from_id().
*/
public function testGet_element_from_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_container_from_id().
*/
public function testGet_container_from_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testList_containers().
*/
public function testList_containers()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpdate_element().
*/
public function testUpdate_element()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testCreate_container().
*/
public function testCreate_container()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testAdd_element_to_container().
*/
public function testAdd_element_to_container()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testDelete_object().
*/
public function testDelete_object()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testList_elements().
*/
public function testList_elements()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_status().
*/
public function testGet_element_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testMap_connector_to_element_status().
*/
public function testMap_connector_to_element_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_error_message_from_status().
*/
public function testGet_error_message_from_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpload().
*/
public function testUpload()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testAcceptable_records().
*/
public function testAcceptable_records()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_object_class_from_type().
*/
public function testGet_object_class_from_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_types().
*/
public function testGet_element_types()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_container_types().
*/
public function testGet_container_types()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_category_list().
*/
public function testGet_category_list()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,339 +0,0 @@
<?php
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../Bridge_datas.inc';
class Bridge_Api_YoutubeTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Youtube
*/
protected $object;
public function setUp()
{
$this->object = $this->getMock("Bridge_Api_Youtube", array("initialize_transport", "set_auth_params"), array(registry::get_instance(), $this->getMock("Bridge_Api_Auth_Interface")));
}
/**
* @todo Implement testConnect().
*/
public function testConnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReconnect().
*/
public function testReconnect()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_user_id().
*/
public function testGet_user_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_user_name().
*/
public function testGet_user_name()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_name().
*/
public function testGet_name()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_icon_url().
*/
public function testGet_icon_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_image_url().
*/
public function testGet_image_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_url().
*/
public function testGet_url()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_infos().
*/
public function testGet_infos()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_default_element_type().
*/
public function testGet_default_element_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_default_container_type().
*/
public function testGet_default_container_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_types().
*/
public function testGet_element_types()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_container_types().
*/
public function testGet_container_types()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_object_class_from_type().
*/
public function testGet_object_class_from_type()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testList_elements().
*/
public function testList_elements()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testList_containers().
*/
public function testList_containers()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpdate_element().
*/
public function testUpdate_element()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testCreate_container().
*/
public function testCreate_container()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testAdd_element_to_container().
*/
public function testAdd_element_to_container()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testDelete_object().
*/
public function testDelete_object()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testAcceptable_records().
*/
public function testAcceptable_records()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_status().
*/
public function testGet_element_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testMap_connector_to_element_status().
*/
public function testMap_connector_to_element_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_error_message_from_status().
*/
public function testGet_error_message_from_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testHandle_exception().
*/
public function testHandle_exception()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpload().
*/
public function testUpload()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_element_from_id().
*/
public function testGet_element_from_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_category_list().
*/
public function testGet_category_list()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_container_from_id().
*/
public function testGet_container_from_id()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}

View File

@@ -1,11 +1,11 @@
<?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../Bridge_datas.inc';
require_once __DIR__ . '/../../../../lib/classes/Bridge/Api/Dailymotion/Container.class.php';
class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Dailymotion_Container
*/
@@ -20,18 +20,12 @@ class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
);
}
/**
* @todo Implement testGet_created_on().
*/
public function testGet_created_on()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertNull($this->object->get_created_on());
}
/**
* @todo Implement testGet_description().
*/
public function testGet_description()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
@@ -42,9 +36,6 @@ class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
$this->assertEmpty($this->object->get_description());
}
/**
* @todo Implement testGet_id().
*/
public function testGet_id()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
@@ -55,18 +46,12 @@ class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
$this->assertEmpty($this->object->get_id());
}
/**
* @todo Implement testGet_thumbnail().
*/
public function testGet_thumbnail()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertEquals('thumb', $this->object->get_thumbnail());
}
/**
* @todo Implement testGet_title().
*/
public function testGet_title()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
@@ -77,31 +62,21 @@ class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
$this->assertEmpty($this->object->get_title());
}
/**
* @todo Implement testGet_type().
*/
public function testGet_type()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertEquals('playlist', $this->object->get_type());
}
/**
* @todo Implement testGet_updated_on().
*/
public function testGet_updated_on()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertNull($this->object->get_updated_on());
}
/**
* @todo Implement testGet_url().
*/
public function testGet_url()
{
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertEquals('url', $this->object->get_url());
}
}

View File

@@ -6,7 +6,6 @@ require_once __DIR__ . '/../../../../lib/classes/Bridge/Api/Dailymotion/Element.
class Bridge_Api_Dailymotion_ElementTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Dailymotion_Element
*/
@@ -156,5 +155,4 @@ class Bridge_Api_Dailymotion_ElementTest extends PHPUnit_Framework_TestCase
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object->get_category());
$this->assertEmpty($this->object->get_category());
}
}

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../Bridge_datas.inc';
class Bridge_Api_Flickr_ContainerTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Flickr_Container
*/
@@ -72,5 +71,4 @@ class Bridge_Api_Flickr_ContainerTest extends PHPUnit_Framework_TestCase
$this->assertEquals("photoset", $this->object->get_type());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object->get_type());
}
}

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../Bridge_datas.inc';
class Bridge_Api_Flickr_ElementTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Flickr_Element
*/
@@ -158,5 +157,4 @@ class Bridge_Api_Flickr_ElementTest extends PHPUnit_Framework_TestCase
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object_alone->get_type());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object_list->get_type());
}
}

View File

@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../Bridge_datas.inc';
class Bridge_Api_Youtube_ContainerTest extends PHPUnit_Framework_TestCase
{
/**
* @var Bridge_Api_Youtube_Container
*/
@@ -27,15 +26,9 @@ class Bridge_Api_Youtube_ContainerTest extends PHPUnit_Framework_TestCase
$this->object = new Bridge_Api_Youtube_Container($entry, 'playlist', 'my_thumbnail');
}
/**
* @todo fin a way to test getPlaylistId
* @todo find a way to test getPlaylistId
*/
public function testGet_thumbnail()
{
$this->assertEquals("my_thumbnail", $this->object->get_thumbnail());
@@ -77,5 +70,4 @@ class Bridge_Api_Youtube_ContainerTest extends PHPUnit_Framework_TestCase
$this->assertEquals("playlist", $this->object->get_type());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object->get_type());
}
}

Some files were not shown because too many files have changed in this diff Show More