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

View File

@@ -55,6 +55,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
public function tearDown() public function tearDown()
{ {
$this->unsetToken(); $this->unsetToken();
parent::tearDown();
} }
public static function setUpBeforeClass() public static function setUpBeforeClass()
@@ -91,6 +92,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
self::$adminAccount->delete(); self::$adminAccount->delete();
self::$adminApplication->delete(); self::$adminApplication->delete();
} }
parent::tearDownAfterClass();
} }
public function createApplication() public function createApplication()
@@ -1429,8 +1431,8 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
$this->assertTrue(is_object($record->technical_informations)); $this->assertTrue(is_object($record->technical_informations));
foreach ($record->technical_informations as $key => $value) { foreach ($record->technical_informations as $key => $value) {
if(is_string($value)) if (is_string($value))
$this->assertFalse(ctype_digit ($value)); $this->assertFalse(ctype_digit($value));
else else
$this->assertTrue(is_int($value)); $this->assertTrue(is_int($value));
} }

View File

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

View File

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

View File

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

View File

@@ -1,20 +1,5 @@
<?php <?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'; require_once __DIR__ . '/../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Silex\WebTestCase; use Silex\WebTestCase;
@@ -23,7 +8,6 @@ use Symfony\Component\HttpFoundation\Response;
class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{ {
protected static $need_records = 1; protected static $need_records = 1;
protected static $need_subdefs = true; protected static $need_subdefs = true;
@@ -33,16 +17,6 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
}
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../lib/Alchemy/Phrasea/Application/Overview.php'; 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/'); $crawler = $this->client->request('GET', '/datafiles/' . self::$record_1->get_sbas_id() . '/' . self::$record_1->get_record_id() . '/preview/');
$response = $this->client->getResponse(); $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()); $this->assertEquals(302, $response->getStatusCode());
$url = p4string::delEndSlash($registry->get('GV_ServerName')) . $response->headers->get('Location'); $url = p4string::delEndSlash($registry->get('GV_ServerName')) . $response->headers->get('Location');
$headers = http_query::getHttpHeaders($url); $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_mime(), $headers['content_type']);
$this->assertEquals(self::$record_1->get_preview()->get_size(), $headers['download_content_length']); $this->assertEquals(self::$record_1->get_preview()->get_size(), $headers['download_content_length']);
} } else {
else
{
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
$content_disposition = explode(';', $response->headers->get('content-disposition')); $content_disposition = explode(';', $response->headers->get('content-disposition'));
$this->assertEquals($content_disposition[0], 'attachment'); $this->assertEquals($content_disposition[0], 'attachment');
@@ -113,12 +84,9 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('GET', $url); $crawler = $this->client->request('GET', $url);
$response = $this->client->getResponse(); $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()); $this->assertEquals(302, $response->getStatusCode());
} } else {
else
{
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
@@ -127,5 +95,4 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$response = $this->client->getResponse(); $response = $this->client->getResponse();
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
} }

View File

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

View File

@@ -21,7 +21,6 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAbstract
* @var \connection_pdo * @var \connection_pdo
*/ */
protected $connection; protected $connection;
protected $registry = array(); protected $registry = array();
public function createApplication() public function createApplication()
@@ -194,24 +193,21 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAbstract
public function temporaryReInstall() public function temporaryReInstall()
{ {
if (file_exists($this->root . 'config/config.yml.unitTests')) { 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'); unlink($this->root . 'config/config.yml');
} }
rename($this->root . 'config/config.yml.unitTests', $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.unitTests')) {
if(file_exists($this->root . 'config/services.yml')) if (file_exists($this->root . 'config/services.yml')) {
{
unlink($this->root . 'config/services.yml'); unlink($this->root . 'config/services.yml');
} }
rename($this->root . 'config/services.yml.unitTests', $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.unitTests')) {
if(file_exists($this->root . 'config/connexions.yml')) if (file_exists($this->root . 'config/connexions.yml')) {
{
unlink($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 class ApcCacheTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var ApcCache * @var ApcCache
*/ */
@@ -12,8 +11,7 @@ class ApcCacheTest extends \PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
if (!extension_loaded('apc')) if ( ! extension_loaded('apc')) {
{
$this->markTestSkipped('Apc is not installed'); $this->markTestSkipped('Apc is not installed');
} }
$this->object = new \Alchemy\Phrasea\Cache\ApcCache; $this->object = new \Alchemy\Phrasea\Cache\ApcCache;
@@ -44,6 +42,5 @@ class ApcCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.' '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 class ArrayCacheTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var ArrayCache * @var ArrayCache
*/ */
@@ -40,6 +39,5 @@ class ArrayCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.' '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 class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var MemcacheCache * @var MemcacheCache
*/ */
@@ -14,14 +13,12 @@ class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
{ {
$this->object = new \Alchemy\Phrasea\Cache\MemcacheCache; $this->object = new \Alchemy\Phrasea\Cache\MemcacheCache;
if(!class_exists('Memcache')) if ( ! class_exists('Memcache')) {
{
$this->markTestSkipped('No memcache extension'); $this->markTestSkipped('No memcache extension');
} }
$memcache = new Memcache(); $memcache = new Memcache();
if(!@$memcache->connect('localhost', 11211)) if ( ! @$memcache->connect('localhost', 11211)) {
{
$this->markTestSkipped('No memcache server'); $this->markTestSkipped('No memcache server');
} }
@@ -53,6 +50,5 @@ class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }
} }

View File

@@ -1,20 +1,5 @@
<?php <?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'; require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class RedisTest extends \PhraseanetPHPUnitAbstract class RedisTest extends \PhraseanetPHPUnitAbstract
@@ -22,24 +7,17 @@ class RedisTest extends \PhraseanetPHPUnitAbstract
public function testBasics() public function testBasics()
{ {
if (extension_loaded('Redis')) if (extension_loaded('Redis')) {
{
$redis = new Redis(); $redis = new Redis();
try try {
{
$ok = @$redis->connect('127.0.0.1', 6379); $ok = @$redis->connect('127.0.0.1', 6379);
} } catch (\Exception $e) {
catch(\Exception $e)
{
$ok = false; $ok = false;
} }
if (!$ok) if ( ! $ok) {
{
$this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis'); $this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis');
} }
} } else {
else
{
$this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis'); $this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis');
} }
@@ -66,5 +44,4 @@ class RedisTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($redis, $cache->getRedis()); $this->assertEquals($redis, $cache->getRedis());
} }
} }

View File

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

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -75,14 +58,11 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($this->client->getResponse()->isRedirect()); $this->assertTrue($this->client->getResponse()->isRedirect());
try try {
{
$field = \databox_field::get_instance($databox, $id); $field = \databox_field::get_instance($databox, $id);
$field->delete(); $field->delete();
$this->fail("should raise an exception"); $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(); $fields = $databox->get_meta_structure();
$find = false; $find = false;
foreach ($fields as $field) foreach ($fields as $field) {
{ if ($field->get_name() === databox_field::generateName($name)) {
if ($field->get_name() === databox_field::generateName($name))
{
$field->delete(); $field->delete();
$find = true; $find = true;
} }
} }
if (!$find) if ( ! $find) {
{
$this->fail("should have create a new field"); $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->client->request("GET", "/description/" . $databox->get_sbas_id() . "/");
$this->assertTrue($this->client->getResponse()->isOk()); $this->assertTrue($this->client->getResponse()->isOk());
} }
} }

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -53,8 +36,8 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals("application/json", $response->headers->get("content-type")); $this->assertEquals("application/json", $response->headers->get("content-type"));
$datas = json_decode($response->getContent()); $datas = json_decode($response->getContent());
$this->assertTrue(is_object($datas)); $this->assertTrue(is_object($datas));
$this->assertTrue(!!$datas->result); $this->assertTrue( ! ! $datas->result);
$this->assertEquals($field->is_multi(), !!$datas->is_multi); $this->assertEquals($field->is_multi(), ! ! $datas->is_multi);
$field->delete(); $field->delete();
} }
@@ -73,10 +56,9 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals("application/json", $response->headers->get("content-type")); $this->assertEquals("application/json", $response->headers->get("content-type"));
$datas = json_decode($response->getContent()); $datas = json_decode($response->getContent());
$this->assertTrue(is_object($datas)); $this->assertTrue(is_object($datas));
$this->assertTrue(!!$datas->result); $this->assertTrue( ! ! $datas->result);
$this->assertEquals($field->is_readonly(), !!$datas->is_readonly); $this->assertEquals($field->is_readonly(), ! ! $datas->is_readonly);
$field->delete(); $field->delete();
} }
} }

View File

@@ -7,21 +7,10 @@ use Symfony\Component\HttpFoundation\Response;
class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthenticatedAbstract class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{ {
public static $account = null; public static $account = null;
public static $api = null; public static $api = null;
protected $client; protected $client;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
}
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
@@ -40,8 +29,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
$this->assertTrue($this->client->getResponse()->isOk()); $this->assertTrue($this->client->getResponse()->isOk());
$feeds = Feed_Collection::load_all(appbox::get_instance(\bootstrap::getCore()), self::$user); $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); $this->assertRegExp('/\/admin\/publications\/feed\/' . $feed->get_id() . '/', $pageContent);
if ($feed->get_collection() != null) if ($feed->get_collection() != null)
$this->assertRegExp('/' . $feed->get_collection()->get_name() . '/', $pageContent); $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()); $appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox) foreach ($appbox->get_databoxes() as $databox) {
{ foreach ($databox->get_collections() as $collection) {
foreach ($databox->get_collections() as $collection)
{
$base_id = $collection->get_base_id(); $base_id = $collection->get_base_id();
break; break;
} }
@@ -252,13 +238,10 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
$this->assertTrue($response->isOk()); $this->assertTrue($response->isOk());
$feed = new Feed_Adapter($appbox, $feed->get_id()); $feed = new Feed_Adapter($appbox, $feed->get_id());
try try {
{
$file = new SplFileObject(__DIR__ . '/../../../../testfiles/logocoll1.gif'); $file = new SplFileObject(__DIR__ . '/../../../../testfiles/logocoll1.gif');
$this->fail('logo not deleted'); $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(); $response = $this->client->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
try try {
{
$feed = new Feed_Adapter($appbox, $feed->get_id()); $feed = new Feed_Adapter($appbox, $feed->get_id());
$feed->delete(); $feed->delete();
$this->fail("fail deleting feed"); $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 class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -46,5 +29,4 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request('GET', '/'); $this->client->request('GET', '/');
$this->assertTrue($this->client->getResponse()->isOk()); $this->assertTrue($this->client->getResponse()->isOk());
} }
} }

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -69,13 +52,10 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$subdefs->add_subdef("image", "name", "class"); $subdefs->add_subdef("image", "name", "class");
$this->client->request("POST", "/subdefs/" . $databox->get_sbas_id() . "/", array('delete_subdef' => 'group_name')); $this->client->request("POST", "/subdefs/" . $databox->get_sbas_id() . "/", array('delete_subdef' => 'group_name'));
$this->assertTrue($this->client->getResponse()->isRedirect()); $this->assertTrue($this->client->getResponse()->isRedirect());
try try {
{
$subdefs->get_subdef("image", "name"); $subdefs->get_subdef("image", "name");
$this->fail("should raise an exception"); $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"); $subdefs->delete_subdef("image", "name");
} }
} }

View File

@@ -4,27 +4,11 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
protected $usersParameters; protected $usersParameters;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
@@ -32,8 +16,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function setUp() public function setUp()
{ {
$this->usersParameters = array("users" => implode(';', array(self::$user->get_id(), self::$user_alt1->get_id())));
parent::setUp(); parent::setUp();
$this->usersParameters = array("users" => implode(';', array(self::$user->get_id(), self::$user_alt1->get_id())));
$this->client = $this->createClient(); $this->client = $this->createClient();
} }
@@ -62,14 +46,11 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request('POST', '/users/delete/', array('users' => $id)); $this->client->request('POST', '/users/delete/', array('users' => $id));
$response = $this->client->getResponse(); $response = $this->client->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
try try {
{
$user = User_Adapter::getInstance($id, $appbox); $user = User_Adapter::getInstance($id, $appbox);
$user->delete(); $user->delete();
$this->fail("user not deleted"); $this->fail("user not deleted");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -122,7 +103,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testRouteQuota() public function testRouteQuota()
{ {
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base())); $base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
$params = array('base_id'=>$base_id, 'users'=>self::$user->get_id()); $params = array('base_id' => $base_id, 'users' => self::$user->get_id());
$this->client->request('POST', '/users/rights/quotas/', $params); $this->client->request('POST', '/users/rights/quotas/', $params);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
@@ -142,7 +123,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testRouteQuotaRemove() public function testRouteQuotaRemove()
{ {
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base())); $base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
$params = array('base_id'=>$base_id, 'users'=>self::$user->get_id()); $params = array('base_id' => $base_id, 'users' => self::$user->get_id());
$this->client->request('POST', '/users/rights/quotas/apply/', $params); $this->client->request('POST', '/users/rights/quotas/apply/', $params);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
@@ -152,7 +133,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testRouteRightTime() public function testRouteRightTime()
{ {
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base())); $base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
$params = array('base_id'=>$base_id, 'users'=>self::$user->get_id()); $params = array('base_id' => $base_id, 'users' => self::$user->get_id());
$this->client->request('POST', '/users/rights/time/', $params); $this->client->request('POST', '/users/rights/time/', $params);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
@@ -180,7 +161,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testRouteRightMask() public function testRouteRightMask()
{ {
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base())); $base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
$params = array('base_id'=>$base_id, 'users'=>self::$user->get_id()); $params = array('base_id' => $base_id, 'users' => self::$user->get_id());
$this->client->request('POST', '/users/rights/masks/', $params); $this->client->request('POST', '/users/rights/masks/', $params);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
@@ -287,18 +268,14 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(is_object($datas)); $this->assertTrue(is_object($datas));
$this->assertFalse($datas->error); $this->assertFalse($datas->error);
try try {
{
$user = \User_Adapter::getInstance((int) $datas->data, $appbox); $user = \User_Adapter::getInstance((int) $datas->data, $appbox);
$user->delete(); $user->delete();
} } catch (\Exception $e) {
catch (\Exception $e)
{
$this->fail("could not delete created user " . $e->getMessage()); $this->fail("could not delete created user " . $e->getMessage());
} }
} }
public function testRouteExportCsv() public function testRouteExportCsv()
{ {
$this->client->request('POST', '/users/export/csv/'); $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")); $this->assertEquals("attachment; filename=export.txt", $response->headers->get("content-disposition"));
} }
public function testResetRights() public function testResetRights()
{ {
$appbox = \appbox::get_instance(self::$core); $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())); $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( $rights = array(
'bas_manage' => '1' 'bas_manage' => '1'
@@ -330,8 +305,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights); $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(); $base_id = $collection->get_base_id();
$user->ACL()->give_access_to_base(array($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)); $this->assertFalse($user->ACL()->has_access_to_base($base_id));
$user->delete(); $user->delete();
} }
} }

View File

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

View File

@@ -1,28 +1,12 @@
<?php <?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__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\Helper; use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor; use Alchemy\Phrasea\RouteProcessor as routeProcessor;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{ {
protected $client; protected $client;
protected static $need_records = 2; protected static $need_records = 2;
@@ -328,8 +312,7 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode()); $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()); $filter = sprintf("form[action='/prod/baskets/%s/reorder/']", $elements->getId());
$this->assertEquals(1, $crawler->filter($filter)->count()); $this->assertEquals(1, $crawler->filter($filter)->count());
} }
@@ -461,7 +444,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(2, $basket->getElements()->count()); $this->assertEquals(2, $basket->getElements()->count());
} }
public function testAddElementToValidationPost() public function testAddElementToValidationPost()
{ {
@@ -526,10 +508,9 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$datas = $em->getRepository('Entities\ValidationData')->findAll(); $datas = $em->getRepository('Entities\ValidationData')->findAll();
$this->assertTrue($countDatas < count($datas), 'assert that '.count($datas).' > '.$countDatas ); $this->assertTrue($countDatas < count($datas), 'assert that ' . count($datas) . ' > ' . $countDatas);
} }
public function testAddElementPostJSON() public function testAddElementPostJSON()
{ {
$basket = $this->insertOneBasket(); $basket = $this->insertOneBasket();
@@ -594,7 +575,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$basket = $em->getRepository('Entities\Basket')->find($Basket_2->getId()); $basket = $em->getRepository('Entities\Basket')->find($Basket_2->getId());
$this->assertInstanceOf('\Entities\Basket', $basket); $this->assertInstanceOf('\Entities\Basket', $basket);
$this->assertEquals(1, $basket->getElements()->count()); $this->assertEquals(1, $basket->getElements()->count());
} }
public function testRouteStealElementsJson() public function testRouteStealElementsJson()
@@ -636,7 +616,6 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$basket = $em->getRepository('Entities\Basket')->find($Basket_2->getId()); $basket = $em->getRepository('Entities\Basket')->find($Basket_2->getId());
$this->assertInstanceOf('\Entities\Basket', $basket); $this->assertInstanceOf('\Entities\Basket', $basket);
$this->assertEquals(1, $basket->getElements()->count()); $this->assertEquals(1, $basket->getElements()->count());
} }
/** /**
@@ -690,5 +669,4 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(0, $count); $this->assertEquals(0, $count);
} }
} }

View File

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

View File

@@ -2,29 +2,11 @@
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc'; require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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; protected static $need_records = 1;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -57,7 +39,6 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($response->isOk()); $this->assertTrue($response->isOk());
} }
public function testVocabulary() public function testVocabulary()
{ {
$this->client->request('GET', '/records/edit/vocabulary/Zanzibar/'); $this->client->request('GET', '/records/edit/vocabulary/Zanzibar/');
@@ -74,7 +55,7 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$datas = json_decode($response->getContent()); $datas = json_decode($response->getContent());
$this->assertFalse($datas->success); $this->assertFalse($datas->success);
$params = array('sbas_id'=>self::$collection->get_sbas_id()); $params = array('sbas_id' => self::$collection->get_sbas_id());
$this->client->request('GET', '/records/edit/vocabulary/Zanzibar/', $params); $this->client->request('GET', '/records/edit/vocabulary/Zanzibar/', $params);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
@@ -82,7 +63,7 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$datas = json_decode($response->getContent()); $datas = json_decode($response->getContent());
$this->assertFalse($datas->success); $this->assertFalse($datas->success);
$params = array('sbas_id'=>self::$collection->get_sbas_id()); $params = array('sbas_id' => self::$collection->get_sbas_id());
$this->client->request('GET', '/records/edit/vocabulary/User/', $params); $this->client->request('GET', '/records/edit/vocabulary/User/', $params);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
@@ -90,5 +71,4 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$datas = json_decode($response->getContent()); $datas = json_decode($response->getContent());
$this->assertTrue($datas->success); $this->assertTrue($datas->success);
} }
} }

View File

@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Response;
class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/** /**
* *
* @var Feed_Adapter * @var Feed_Adapter
@@ -82,15 +81,11 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function tearDown() public function tearDown()
{ {
if ($this->feed instanceof Feed_Adapter) if ($this->feed instanceof Feed_Adapter) {
{
$this->feed->delete(); $this->feed->delete();
} } else if ($this->entry instanceof Feed_Entry_Adapter) {
else if($this->entry instanceof Feed_Entry_Adapter)
{
$this->entry->delete(); $this->entry->delete();
if ($this->publisher instanceof Feed_Publisher_Adapter) if ($this->publisher instanceof Feed_Publisher_Adapter) {
{
$this->publisher->delete(); $this->publisher->delete();
} }
} }
@@ -109,10 +104,8 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('POST', '/feeds/requestavailable/'); $crawler = $this->client->request('POST', '/feeds/requestavailable/');
$this->assertTrue($this->client->getResponse()->isOk()); $this->assertTrue($this->client->getResponse()->isOk());
$feeds = Feed_Collection::load_all($appbox, self::$user); $feeds = Feed_Collection::load_all($appbox, self::$user);
foreach ($feeds->get_feeds() as $one_feed) foreach ($feeds->get_feeds() as $one_feed) {
{ if ($one_feed->is_publisher(self::$user)) {
if ($one_feed->is_publisher(self::$user))
{
$this->assertEquals(1, $crawler->filterXPath("//input[@value='" . $one_feed->get_id() . "']")->count()); $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/'); $crawler = $this->client->request('GET', '/feeds/entry/' . $this->entry->get_id() . '/edit/');
$pageContent = $this->client->getResponse()->getContent(); $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()); $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->assertFalse($pageContent->error);
$this->assertTrue(is_string($pageContent->message)); $this->assertTrue(is_string($pageContent->message));
try try {
{
Feed_Entry_Adapter::load_from_id($appbox, $this->entry->get_id()); Feed_Entry_Adapter::load_from_id($appbox, $this->entry->get_id());
$this->fail("Failed to delete entry"); $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); $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() . "/']"; $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()); $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); $this->assertEquals(1, $crawler->filterXPath($path)->count(), $msg);
} } else {
else
{
$this->fail('Feed_collection::load_all should return feed where I got access'); $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() . "/"); $crawler = $this->client->request('GET', '/feeds/feed/' . $this->feed->get_id() . "/");
$pageContent = $this->client->getResponse()->getContent(); $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() . "/']"; $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()); $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); $this->assertEquals(1, $crawler->filterXPath($path)->count(), $msg);
} } else {
else
{
$this->fail('Feed_collection::load_all should return feed where I got access'); $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(); $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); $this->assertContains($suscribe_link, $pageContent->texte);
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerLanguageTest extends PhraseanetWebTestCaseAbstract class ControllerLanguageTest extends PhraseanetWebTestCaseAbstract
{ {
protected $client; protected $client;
public function setUp() public function setUp()
@@ -43,5 +27,4 @@ class ControllerLanguageTest extends PhraseanetWebTestCaseAbstract
$pageContent = json_decode($this->client->getResponse()->getContent()); $pageContent = json_decode($this->client->getResponse()->getContent());
$this->assertTrue(is_object($pageContent)); $this->assertTrue(is_object($pageContent));
} }
} }

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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; protected static $need_records = 1;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -56,5 +39,4 @@ class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAb
$this->assertTrue($response->isOk()); $this->assertTrue($response->isOk());
} }
} }

View File

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

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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; protected static $need_records = 4;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -73,8 +56,7 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_THUMBNAILGRID \Alchemy\Phrasea\Out\Module\PDF::LAYOUT_THUMBNAILGRID
); );
foreach ($layouts as $layout) foreach ($layouts as $layout) {
{
$crawler = $this->client->request('POST', '/printer/print.pdf', array( $crawler = $this->client->request('POST', '/printer/print.pdf', array(
'lst' => $lst, 'lst' => $lst,
'lay' => $layout 'lay' => $layout
@@ -88,5 +70,4 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($response->isOk()); $this->assertTrue($response->isOk());
} }
} }
} }

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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; protected static $need_records = 2;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -72,8 +55,8 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
); );
$receivers = array( $receivers = array(
array('usr_id'=>self::$user_alt1->get_id(), 'HD'=>1) array('usr_id' => self::$user_alt1->get_id(), 'HD' => 1)
, array('usr_id'=>self::$user_alt2->get_id(), 'HD'=>0) , array('usr_id' => self::$user_alt2->get_id(), 'HD' => 0)
); );
$params = array( $params = array(
@@ -108,15 +91,15 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$participants = array( $participants = array(
array( array(
'usr_id' => self::$user_alt1->get_id(), 'usr_id' => self::$user_alt1->get_id(),
'agree'=> 0, 'agree' => 0,
'see_others'=> 1, 'see_others' => 1,
'HD'=> 0, 'HD' => 0,
) )
, array( , array(
'usr_id' => self::$user_alt2->get_id(), 'usr_id' => self::$user_alt2->get_id(),
'agree'=> 1, 'agree' => 1,
'see_others'=> 0, 'see_others' => 0,
'HD'=> 1, 'HD' => 1,
) )
); );
@@ -159,5 +142,4 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(is_array($datas), 'Json is valid'); $this->assertTrue(is_array($datas), 'Json is valid');
} }
} }

View File

@@ -4,25 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerRootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerRootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -46,7 +30,5 @@ class ControllerRootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
/* @var $response \Symfony\Component\HttpFoundation\Response */ /* @var $response \Symfony\Component\HttpFoundation\Response */
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
} }
} }

View File

@@ -1,16 +1,6 @@
<?php <?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__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Controller/Prod/Story.php'; require_once __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Controller/Prod/Story.php';
use Doctrine\Common\DataFixtures\Loader; use Doctrine\Common\DataFixtures\Loader;
@@ -18,15 +8,8 @@ use PhraseaFixture\Basket as MyFixture;
use Alchemy\Phrasea\Helper; use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor; use Alchemy\Phrasea\RouteProcessor as routeProcessor;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
protected $client; protected $client;
/** /**
@@ -190,8 +173,7 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$totalRecords = count($records); $totalRecords = count($records);
$n = 0; $n = 0;
foreach ($records as $record) foreach ($records as $record) {
{
/* @var $record \record_adapter */ /* @var $record \record_adapter */
$route = sprintf( $route = sprintf(
"/story/%s/%s/delete/%s/%s/" "/story/%s/%s/delete/%s/%s/"
@@ -201,16 +183,13 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, $record->get_record_id() , $record->get_record_id()
); );
if (($n % 2) === 0) if (($n % 2) === 0) {
{
$crawler = $this->client->request('POST', $route); $crawler = $this->client->request('POST', $route);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
$this->assertEquals(302, $response->getStatusCode()); $this->assertEquals(302, $response->getStatusCode());
} } else {
else
{
$crawler = $this->client->request( $crawler = $this->client->request(
'POST', $route, array(), array(), array( 'POST', $route, array(), array(), array(
"HTTP_ACCEPT" => "application/json") "HTTP_ACCEPT" => "application/json")
@@ -219,10 +198,9 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
$n++; $n ++;
$this->assertEquals($totalRecords - $n, self::$story_1->get_children()->get_count()); $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 class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
protected $client; protected $client;
protected static $need_records = 1; protected static $need_records = 1;
protected static $need_subdefs = true; protected static $need_subdefs = true;
@@ -69,8 +68,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, sprintf($route_base, 'overview') , sprintf($route_base, 'overview')
); );
foreach ($routes as $route) foreach ($routes as $route) {
{
$crawler = $this->client->request('POST', $route); $crawler = $this->client->request('POST', $route);
$pageContent = $this->client->getResponse()->getContent(); $pageContent = $this->client->getResponse()->getContent();
$this->assertTrue($this->client->getResponse()->isOk()); $this->assertTrue($this->client->getResponse()->isOk());
@@ -90,8 +88,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, sprintf($route_base, 'overview') , sprintf($route_base, 'overview')
); );
foreach ($routes as $route) foreach ($routes as $route) {
{
$option = new \searchEngine_options(); $option = new \searchEngine_options();
$crawler = $this->client->request('POST', $route, array('options_serial' => serialize($option))); $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(); $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() $route = '/tooltip/metas/FieldInfos/' . $databox->get_sbas_id()
. '/' . $field->get_id() . '/'; . '/' . $field->get_id() . '/';
@@ -134,22 +130,18 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, databox_field::DCES_DESCRIPTION => new databox_Field_DCES_Description() , 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); $dces_element = array_shift($dces);
$field->set_dces_element($dces_element); $field->set_dces_element($dces_element);
$route = '/tooltip/DCESInfos/' . $databox->get_sbas_id() $route = '/tooltip/DCESInfos/' . $databox->get_sbas_id()
. '/' . $field->get_id() . '/'; . '/' . $field->get_id() . '/';
if ($field->get_dces_element() !== null) if ($field->get_dces_element() !== null) {
{
$crawler = $this->client->request('POST', $route); $crawler = $this->client->request('POST', $route);
$this->assertGreaterThan(0, strlen($this->client->getResponse()->getContent())); $this->assertGreaterThan(0, strlen($this->client->getResponse()->getContent()));
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
} } else {
else
{
$crawler = $this->client->request('POST', $route); $crawler = $this->client->request('POST', $route);
$this->assertEquals(0, strlen($this->client->getResponse()->getContent())); $this->assertEquals(0, strlen($this->client->getResponse()->getContent()));
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -161,8 +153,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
$databox = self::$record_1->get_databox(); $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() $route = '/tooltip/metas/restrictionsInfos/' . $databox->get_sbas_id()
. '/' . $field->get_id() . '/'; . '/' . $field->get_id() . '/';
@@ -192,5 +183,4 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->client->request('POST', $route); $this->client->request('POST', $route);
$this->assertTrue($this->client->getResponse()->isOk()); $this->assertTrue($this->client->getResponse()->isOk());
} }
} }

View File

@@ -4,26 +4,9 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/**
* As controllers use WebTestCase, it requires a client
*/
protected $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 static $need_records = false;
/**
* The application loader
*/
public function createApplication() public function createApplication()
{ {
return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php'; return require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Prod.php';
@@ -73,16 +56,14 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
if ($owners) if ($owners)
$this->assertTrue(count($list->owners) > 0); $this->assertTrue(count($list->owners) > 0);
foreach ($list->owners as $owner) foreach ($list->owners as $owner) {
{
$this->checkOwner($owner); $this->checkOwner($owner);
} }
if ($users) if ($users)
$this->assertTrue(count($list->users) > 0); $this->assertTrue(count($list->users) > 0);
foreach ($list->users as $user) foreach ($list->users as $user) {
{
$this->checkUser($user); $this->checkUser($user);
} }
} }
@@ -475,5 +456,4 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertObjectHasAttribute('company', $user); $this->assertObjectHasAttribute('company', $user);
$this->assertObjectHasAttribute('email', $user); $this->assertObjectHasAttribute('email', $user);
} }
} }

View File

@@ -1,28 +1,12 @@
<?php <?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__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\Helper; use Alchemy\Phrasea\Helper;
use Alchemy\Phrasea\RouteProcessor as routeProcessor; use Alchemy\Phrasea\RouteProcessor as routeProcessor;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
protected $client; protected $client;
protected static $need_records = 1; protected static $need_records = 1;
protected static $need_story = true; protected static $need_story = true;
@@ -209,5 +193,4 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$route = sprintf("/WorkZone/detachStory/%s/%s/", $story->get_sbas_id(), 'unknow'); $route = sprintf("/WorkZone/detachStory/%s/%s/", $story->get_sbas_id(), 'unknow');
//story not yet Attched //story not yet Attched
} }
} }

View File

@@ -11,7 +11,6 @@ use Symfony\Component\DomCrawler\Crawler;
class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
{ {
/** /**
* *
* @var Feed_Adapter * @var Feed_Adapter
@@ -90,16 +89,13 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function tearDown() public function tearDown()
{ {
if (self::$publisher instanceof Feed_Publisher_Adapter) if (self::$publisher instanceof Feed_Publisher_Adapter) {
{
self::$publisher->delete(); self::$publisher->delete();
} }
if (self::$entry instanceof Feed_Entry_Adapter) if (self::$entry instanceof Feed_Entry_Adapter) {
{
self::$entry->delete(); self::$entry->delete();
} }
if (self::$feed instanceof Feed_Adapter) if (self::$feed instanceof Feed_Adapter) {
{
self::$feed->delete(); self::$feed->delete();
} }
parent::tearDown(); parent::tearDown();
@@ -129,8 +125,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$publisher = array_shift(self::$feed_4_public->get_publishers()); $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'); $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_1);
$item = Feed_Entry_Item::create($appbox, $entry, self::$record_2); $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'); $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() public function testPublicFeed()
{ {
$appbox = appbox::get_instance(\bootstrap::getCore()); $appbox = appbox::get_instance(\bootstrap::getCore());
@@ -262,7 +256,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->evaluateAtom($response); $this->evaluateAtom($response);
} }
//$app->get('/feeds/userfeed/aggregated/{token}/{format}/', function($token, $format) use ($app, $appbox, $display_feed)
public function testUserFeedAggregated() public function testUserFeedAggregated()
{ {
$appbox = appbox::get_instance(\bootstrap::getCore()); $appbox = appbox::get_instance(\bootstrap::getCore());
@@ -283,7 +276,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->evaluateAtom($response); $this->evaluateAtom($response);
} }
//$app->get('/feeds/userfeed/{token}/{id}/{format}/', function($token, $id, $format) use ($app, $appbox, $display_feed)
public function testUserFeed() public function testUserFeed()
{ {
$appbox = appbox::get_instance(\bootstrap::getCore()); $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())); $feeds = Feed_Collection::load_public_feeds(appbox::get_instance(\bootstrap::getCore()));
$all_feeds = $feeds->get_feeds(); $all_feeds = $feeds->get_feeds();
foreach ($all_feeds as $feed) foreach ($all_feeds as $feed) {
{
$this->assertTrue($feed->is_public()); $this->assertTrue($feed->is_public());
} }
$crawler = $this->client->request("GET", "/feeds/aggregated/rss/"); $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())); $feeds = Feed_Collection::load_public_feeds(appbox::get_instance(\bootstrap::getCore()));
$all_feeds = $feeds->get_feeds(); $all_feeds = $feeds->get_feeds();
foreach ($all_feeds as $feed) foreach ($all_feeds as $feed) {
{
$this->assertTrue($feed->is_public()); $this->assertTrue($feed->is_public());
} }
$crawler = $this->client->request("GET", "/feeds/aggregated/atom/"); $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 * XML is not verified due to Validator Service bug
*/ */
return; return;
try try {
{
$validator = new W3CFeedRawValidator($xml); $validator = new W3CFeedRawValidator($xml);
$response = $validator->validate(); $response = $validator->validate();
$this->assertTrue($response->isValid(), $xml . "\n" . $response); $this->assertTrue($response->isValid(), $xml . "\n" . $response);
} } catch (W3CFeedValidatorException $e) {
catch (W3CFeedValidatorException $e)
{
print "\nCould not use W3C FEED VALIDATOR API : " . $e->getMessage() . "\n"; 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) function checkRSSRootNode(DOMXPath $xpath, Feed_Adapter $feed)
{ {
$channel = $xpath->query("/rss/channel"); $channel = $xpath->query("/rss/channel");
foreach ($channel->item(0)->childNodes as $child) foreach ($channel->item(0)->childNodes as $child) {
{ if ($child->nodeType !== XML_TEXT_NODE) {
if ($child->nodeType !== XML_TEXT_NODE) switch ($child->nodeName) {
{
switch ($child->nodeName)
{
case 'title': case 'title':
$this->assertEquals($feed->get_title(), $child->nodeValue); $this->assertEquals($feed->get_title(), $child->nodeValue);
break; break;
@@ -465,10 +448,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals("http://blogs.law.harvard.edu/tech/rss", $child->nodeValue); $this->assertEquals("http://blogs.law.harvard.edu/tech/rss", $child->nodeValue);
break; break;
case 'atom:link': case 'atom:link':
foreach ($child->attributes as $attribute) foreach ($child->attributes as $attribute) {
{ if ($attribute->name == "href") {
if ($attribute->name == "href")
{
$this->assertEquals($feed->get_homepage_link(registry::get_instance(), Feed_Adapter::FORMAT_RSS, 1)->get_href(), $attribute->value); $this->assertEquals($feed->get_homepage_link(registry::get_instance(), Feed_Adapter::FORMAT_RSS, 1)->get_href(), $attribute->value);
break; break;
} }
@@ -488,19 +469,16 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$collection = $feed->get_entries($offset_start, $n_entries); $collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries(); $entries = $collection->get_entries();
foreach ($list_entries as $node) foreach ($list_entries as $node) {
{ if (sizeof($entries) == 0) {
if (sizeof($entries) == 0) $offset_start = ($offset_start ++ ) * $n_entries;
{
$offset_start = ($offset_start++) * $n_entries;
$collection = $feed->get_entries($offset_start, $n_entries); $collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries(); $entries = $collection->get_entries();
if (sizeof($entries) == 0) //no more if (sizeof($entries) == 0) //no more
break; break;
} }
$feed_entry = array_shift($entries); $feed_entry = array_shift($entries);
switch ($node->nodeName) switch ($node->nodeName) {
{
case 'title': case 'title':
$this->assertEquals($feed_entry->get_title(), $node->nodeValue); $this->assertEquals($feed_entry->get_title(), $node->nodeValue);
break; break;
@@ -525,7 +503,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals($feed_entry->get_link()->get_href(), $node->nodeValue); $this->assertEquals($feed_entry->get_link()->get_href(), $node->nodeValue);
break; break;
} }
$count++; $count ++;
$this->checkRSSEntryItemsNode($xpath, $feed_entry, $count); $this->checkRSSEntryItemsNode($xpath, $feed_entry, $count);
} }
$this->assertEquals($feed->get_count_total_entries(), $count); $this->assertEquals($feed->get_count_total_entries(), $count);
@@ -539,8 +517,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$media_group = $xpath->query("/rss/channel/item[" . $count . "]/media:group"); $media_group = $xpath->query("/rss/channel/item[" . $count . "]/media:group");
$this->assertEquals(sizeof($content), $media_group->length); $this->assertEquals(sizeof($content), $media_group->length);
foreach ($media_group as $media) foreach ($media_group as $media) {
{
$entry_item = array_shift($content); $entry_item = array_shift($content);
$this->verifyMediaItem($entry_item, $media); $this->verifyMediaItem($entry_item, $media);
} }
@@ -548,12 +525,9 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function verifyMediaItem(Feed_Entry_Item $item, DOMNode $node) public function verifyMediaItem(Feed_Entry_Item $item, DOMNode $node)
{ {
foreach ($node->childNodes as $node) foreach ($node->childNodes as $node) {
{ if ($node->nodeType !== XML_TEXT_NODE) {
if ($node->nodeType !== XML_TEXT_NODE) switch ($node->nodeName) {
{
switch ($node->nodeName)
{
case 'media:content' : case 'media:content' :
$this->checkMediaContentAttributes($item, $node); $this->checkMediaContentAttributes($item, $node);
break; break;
@@ -569,8 +543,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function parseAttributes(DOMNode $node) public function parseAttributes(DOMNode $node)
{ {
$current_attributes = array(); $current_attributes = array();
foreach ($node->attributes as $attribute) foreach ($node->attributes as $attribute) {
{
$current_attributes[$attribute->name] = $attribute->value; $current_attributes[$attribute->name] = $attribute->value;
} }
@@ -583,22 +556,17 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$is_thumbnail = false; $is_thumbnail = false;
$record = $entry_item->get_record(); $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'); $ressource = $record->get_subdef('preview');
} } else {
else
{
$ressource = $record->get_thumbnail(); $ressource = $record->get_thumbnail();
$is_thumbnail = true; $is_thumbnail = true;
} }
$permalink = $ressource->get_permalink(); $permalink = $ressource->get_permalink();
foreach ($current_attributes as $attribute => $value) foreach ($current_attributes as $attribute => $value) {
{ switch ($attribute) {
switch ($attribute)
{
case "url": case "url":
$this->assertEquals($permalink->get_url(), $value); $this->assertEquals($permalink->get_url(), $value);
break; break;
@@ -612,7 +580,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals(strtolower($record->get_type()), $value); $this->assertEquals(strtolower($record->get_type()), $value);
break; break;
case "isDefault": case "isDefault":
!$is_thumbnail ? $this->assertEquals("true", $value) : $this->assertEquals("false", $value); ! $is_thumbnail ? $this->assertEquals("true", $value) : $this->assertEquals("false", $value);
break; break;
case "expression": case "expression":
$this->assertEquals("full", $value); $this->assertEquals("full", $value);
@@ -714,25 +682,18 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
); );
foreach ($fields as $key_field => $field) foreach ($fields as $key_field => $field) {
{ if ($field["media_field"]["name"] == $node->nodeName) {
if ($field["media_field"]["name"] == $node->nodeName) if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"])) {
{
if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"]))
{
$this->assertEquals($p4field->get_serialized_values($field["separator"]), $node->nodeValue $this->assertEquals($p4field->get_serialized_values($field["separator"]), $node->nodeValue
, sprintf('Asserting good value for DC %s', $field["dc_field"])); , sprintf('Asserting good value for DC %s', $field["dc_field"]));
if (sizeof($field["media_field"]["attributes"]) > 0) if (sizeof($field["media_field"]["attributes"]) > 0) {
{ foreach ($node->attributes as $attribute) {
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->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']); $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"); $this->fail("Missing media:entry");
} }
break; break;
@@ -742,20 +703,17 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function removeBadItems(Array &$item_entries, Array $available_medium) 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'); $preview_sd = $entry_item->get_record()->get_subdef('preview');
$url_preview = $preview_sd->get_permalink(); $url_preview = $preview_sd->get_permalink();
$thumbnail_sd = $entry_item->get_record()->get_thumbnail(); $thumbnail_sd = $entry_item->get_record()->get_thumbnail();
$url_thumb = $thumbnail_sd->get_permalink(); $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 unset($item_entries[$key]); //remove
} }
if (!$url_thumb || !$url_preview) if ( ! $url_thumb || ! $url_preview) {
{
unset($item_entries[$key]); //remove unset($item_entries[$key]); //remove
} }
}; };
@@ -799,11 +757,9 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$collection = $feed->get_entries($offset_start, $n_entries); $collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries(); $entries = $collection->get_entries();
foreach ($entries_item as $entry) foreach ($entries_item as $entry) {
{ if (sizeof($entries) == 0) {
if (sizeof($entries) == 0) $offset_start = ($offset_start ++ ) * $n_entries;
{
$offset_start = ($offset_start++) * $n_entries;
$collection = $feed->get_entries($offset_start, $n_entries); $collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries(); $entries = $collection->get_entries();
if (sizeof($entries) == 0) //no more if (sizeof($entries) == 0) //no more
@@ -811,27 +767,22 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
} }
$feed_entry = array_shift($entries); $feed_entry = array_shift($entries);
$this->checkATOMEntryNode($entry, $xpath, $feed, $feed_entry); $this->checkATOMEntryNode($entry, $xpath, $feed, $feed_entry);
$count++; $count ++;
} }
$this->assertEquals($feed->get_count_total_entries(), $count); $this->assertEquals($feed->get_count_total_entries(), $count);
} }
public function checkATOMEntryNode(DOMNode $node, DOMXPath $xpath, Feed_Adapter $feed, Feed_Entry_Adapter $entry) public function checkATOMEntryNode(DOMNode $node, DOMXPath $xpath, Feed_Adapter $feed, Feed_Entry_Adapter $entry)
{ {
foreach ($node->childNodes as $child) foreach ($node->childNodes as $child) {
{ if ($child->nodeType !== XML_TEXT_NODE) {
if ($child->nodeType !== XML_TEXT_NODE) switch ($child->nodeName) {
{
switch ($child->nodeName)
{
case 'id': 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); $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; break;
case 'link': case 'link':
foreach ($child->attributes as $attribute) foreach ($child->attributes as $attribute) {
{ if ($attribute->name == "href") {
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); $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; break;
} }
@@ -850,8 +801,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals($entry->get_subtitle(), $child->nodeValue); $this->assertEquals($entry->get_subtitle(), $child->nodeValue);
break; break;
case 'author': case 'author':
foreach ($node->childNodes as $child) foreach ($node->childNodes as $child) {
{
if ($child->nodeType !== XML_TEXT_NODE && $child->nodeName == "email") if ($child->nodeType !== XML_TEXT_NODE && $child->nodeName == "email")
$this->assertEquals($entry->get_author_email(), $child->nodeValue); $this->assertEquals($entry->get_author_email(), $child->nodeValue);
if ($child->nodeType !== XML_TEXT_NODE && $child->nodeName == "name") 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"); $media_group = $xpath->query("/Atom:feed/Atom:entry[0]/media:group");
if ($media_group->length > 0) if ($media_group->length > 0) {
{ foreach ($media_group as $media) {
foreach ($media_group as $media)
{
$entry_item = array_shift($content); $entry_item = array_shift($content);
if ($entry_item instanceof Feed_Entry_Item) if ($entry_item instanceof Feed_Entry_Item) {
{
$this->verifyMediaItem($entry_item, $media); $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\Setup as Controller;
use Alchemy\Phrasea\Controller\Utils as ControllerUtils; use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
return call_user_func(function() {
return call_user_func(function()
{
$app = new \Silex\Application(); $app = new \Silex\Application();
$app['Core'] = \bootstrap::getCore(); $app['Core'] = \bootstrap::getCore();
$app['install'] = true; $app['install'] = true;
$app->get('/', function() use ($app) $app->get('/', function() use ($app) {
{
return $app->redirect('/setup/installer/'); return $app->redirect('/setup/installer/');
}); });
@@ -26,7 +23,7 @@ return call_user_func(function()
$app->mount('/connection_test', new ControllerUtils\ConnectionTest()); $app->mount('/connection_test', new ControllerUtils\ConnectionTest());
$app->error(function($e){ $app->error(function($e) {
}); });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,28 +1,12 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
use Alchemy\Phrasea\Core as PhraseaCore; use Alchemy\Phrasea\Core as PhraseaCore;
use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Core\Configuration;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ConfigurationTest extends \PhraseanetPHPUnitAbstract class ConfigurationTest extends \PhraseanetPHPUnitAbstract
{ {
/** /**
* *
* @var \Alchemy\Phrasea\Core\Configuration * @var \Alchemy\Phrasea\Core\Configuration
@@ -109,13 +93,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
$this->confNotInstalled->setEnvironnement("prod"); $this->confNotInstalled->setEnvironnement("prod");
$this->assertEquals("prod", $this->confNotInstalled->getEnvironnement()); $this->assertEquals("prod", $this->confNotInstalled->getEnvironnement());
try try {
{
$this->object->setEnvironnement("unknow"); $this->object->setEnvironnement("unknow");
$this->fail("should raise exception"); $this->fail("should raise exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -165,13 +146,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
$this->object->setEnvironnement("prod"); $this->object->setEnvironnement("prod");
$this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag", $this->object->getPhraseanet()); $this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag", $this->object->getPhraseanet());
$this->object->setEnvironnement("missing_phraseanet"); $this->object->setEnvironnement("missing_phraseanet");
try try {
{
$this->object->getPhraseanet(); $this->object->getPhraseanet();
$this->fail("should raise an exeception"); $this->fail("should raise an exeception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -207,13 +185,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetConnexionException() public function testGetConnexionException()
{ {
try try {
{
$this->object->getConnexion('unknow_connexion'); $this->object->getConnexion('unknow_connexion');
$this->fail('should raise an exception'); $this->fail('should raise an exception');
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -225,13 +200,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetFileExeption() public function testGetFileExeption()
{ {
try try {
{
$this->assertInstanceOf("\SplFileObject", $this->confNotInstalled->getFile()); $this->assertInstanceOf("\SplFileObject", $this->confNotInstalled->getFile());
$this->fail("should raise an excpetion"); $this->fail("should raise an excpetion");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -262,13 +234,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetServiceException() public function testGetServiceException()
{ {
try try {
{
$this->object->getService('unknow_service'); $this->object->getService('unknow_service');
$this->fail('should raise an exception'); $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); $configuration->write($arrayToBeWritten);
$this->fail("should raise an exception"); $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); $configuration = new PhraseaCore\Configuration($handler);
try try {
{
$configuration->delete(); $configuration->delete();
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
@@ -415,12 +378,9 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetTemplating() public function testGetTemplating()
{ {
try try {
{
$templating = $this->object->getTemplating(); $templating = $this->object->getTemplating();
} } catch (\Exception $e) {
catch (\Exception $e)
{
$this->fail("not template_engine provided"); $this->fail("not template_engine provided");
} }
$this->assertTrue(is_string($templating)); $this->assertTrue(is_string($templating));
@@ -428,12 +388,9 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
public function testGetOrm() public function testGetOrm()
{ {
try try {
{
$orm = $this->object->getOrm(); $orm = $this->object->getOrm();
} } catch (\Exception $e) {
catch (\Exception $e)
{
$this->fail("not template_engine provided"); $this->fail("not template_engine provided");
} }
$this->assertTrue(is_string($orm)); $this->assertTrue(is_string($orm));
@@ -479,13 +436,10 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
//append new conf //append new conf
$configuration->write($newScope, FILE_APPEND); $configuration->write($newScope, FILE_APPEND);
try try {
{
$configuration->getConfiguration(); //it is not loaded $configuration->getConfiguration(); //it is not loaded
$this->fail("should raise an exception"); $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"); unlink(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,20 +11,14 @@ class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
if (extension_loaded('apc')) if (extension_loaded('apc')) {
{
$service = $cache->getDriver(); $service = $cache->getDriver();
$this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider); $this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider);
} } else {
else try {
{
try
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -51,13 +30,10 @@ class ServiceApcCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
try try {
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $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()); $this->assertEquals("apc", $cache->getType());
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceArrayCacheTest extends PhraseanetPHPUnitAbstract class ServiceArrayCacheTest extends PhraseanetPHPUnitAbstract
{ {
@@ -36,13 +21,10 @@ class ServiceArrayCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
try try {
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $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()); $this->assertEquals("array", $cache->getType());
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,20 +11,14 @@ class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
if (extension_loaded('memcache')) if (extension_loaded('memcache')) {
{
$service = $cache->getDriver(); $service = $cache->getDriver();
$this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider); $this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider);
} } else {
else try {
{
try
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -51,13 +30,10 @@ class ServiceMemcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
try try {
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $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()); $this->assertEquals(\Alchemy\Phrasea\Core\Service\Cache\MemcacheCache::DEFAULT_PORT, $cache->getPort());
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,20 +11,14 @@ class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
if (extension_loaded('xcache')) if (extension_loaded('xcache')) {
{
$service = $cache->getDriver(); $service = $cache->getDriver();
$this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider); $this->assertTrue($service instanceof \Doctrine\Common\Cache\CacheProvider);
} } else {
else try {
{
try
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch(\Exception $e)
{
} }
} }
@@ -51,13 +30,10 @@ class ServiceXcacheCacheTest extends PhraseanetPHPUnitAbstract
self::$core, array() self::$core, array()
); );
try try {
{
$cache->getDriver(); $cache->getDriver();
$this->fail("should raise an exception"); $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()); $this->assertEquals("xcache", $cache->getType());
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrineMonologTest extends PhraseanetPHPUnitAbstract class DoctrineMonologTest extends PhraseanetPHPUnitAbstract
{ {
protected $options = array( protected $options = array(
"handler" => "rotate" "handler" => "rotate"
, "filename" => "test" , "filename" => "test"
@@ -27,11 +11,6 @@ class DoctrineMonologTest extends PhraseanetPHPUnitAbstract
, 'channel' => 'test' , 'channel' => 'test'
); );
public function setUp()
{
parent::setUp();
}
public function testService() public function testService()
{ {
@@ -53,19 +32,15 @@ class DoctrineMonologTest extends PhraseanetPHPUnitAbstract
public function testExceptionBadOutput() public function testExceptionBadOutput()
{ {
try try {
{
$this->options["output"] = "unknowOutput"; $this->options["output"] = "unknowOutput";
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Monolog( $log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Monolog(
self::$core, $this->options self::$core, $this->options
); );
$log->getDriver(); $log->getDriver();
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
} }

View File

@@ -1,28 +1,12 @@
<?php <?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'; require_once __DIR__ . '/../../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrinePhpechoTest extends PhraseanetPHPUnitAbstract class DoctrinePhpechoTest extends PhraseanetPHPUnitAbstract
{ {
public function testService() public function testService()
{ {
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Phpecho( $log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Phpecho(
self::$core, array() self::$core, array()
); );
@@ -38,5 +22,4 @@ class DoctrinePhpechoTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("phpecho", $log->getType()); $this->assertEquals("phpecho", $log->getType());
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class MonologTest extends PhraseanetPHPUnitAbstract class MonologTest extends PhraseanetPHPUnitAbstract
{ {
protected $options; protected $options;
public function setUp() public function setUp()
@@ -32,7 +16,6 @@ class MonologTest extends PhraseanetPHPUnitAbstract
); );
} }
public function testService() public function testService()
{ {
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog( $log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
@@ -53,63 +36,51 @@ class MonologTest extends PhraseanetPHPUnitAbstract
public function testExceptionMissingOptions() public function testExceptionMissingOptions()
{ {
try try {
{
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog( $log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
public function testExceptionMissingHandler() public function testExceptionMissingHandler()
{ {
try try {
{
unset($this->options["handler"]); unset($this->options["handler"]);
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog( $log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
public function testExceptionUnknowHandler() public function testExceptionUnknowHandler()
{ {
try try {
{
$this->options["handler"] = "unknowHandler"; $this->options["handler"] = "unknowHandler";
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog( $log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
public function testMissingFile() public function testMissingFile()
{ {
try try {
{
unset($this->options["filename"]); unset($this->options["filename"]);
$log = new \Alchemy\Phrasea\Core\Service\Log\Monolog( $log = new \Alchemy\Phrasea\Core\Service\Log\Monolog(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $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()); $this->assertInstanceOf("\Monolog\Logger", $log->getDriver());
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrineTest extends PhraseanetPHPUnitAbstract class DoctrineTest extends PhraseanetPHPUnitAbstract
{ {
protected $options; protected $options;
public function setUp() public function setUp()
@@ -57,15 +41,12 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
public function testExceptionMissingOptions() public function testExceptionMissingOptions()
{ {
try try {
{
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -78,8 +59,7 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
self::$core, $this->options self::$core, $this->options
); );
foreach ($doctrine->getCacheServices()->all() as $service) foreach ($doctrine->getCacheServices()->all() as $service) {
{
$this->assertEquals("array", $service->getType()); $this->assertEquals("array", $service->getType());
} }
} }
@@ -88,15 +68,12 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
{ {
$this->options["cache"]["result"] = "unknowCache"; $this->options["cache"]["result"] = "unknowCache";
try try {
{
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("An exception should be raised"); $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" $this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag"
, $doctrine->getCacheServices()); , $doctrine->getCacheServices());
foreach ($doctrine->getCacheServices()->all() as $service) foreach ($doctrine->getCacheServices()->all() as $service) {
{
$this->assertEquals("array", $service->getType()); $this->assertEquals("array", $service->getType());
} }
@@ -137,16 +113,14 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
, "result" => "xcache_cache" , "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( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag" $this->assertInstanceOf("\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag"
, $doctrine->getCacheServices()); , $doctrine->getCacheServices());
foreach ($doctrine->getCacheServices()->all() as $key => $service) foreach ($doctrine->getCacheServices()->all() as $key => $service) {
{
if ($key === "metadata") if ($key === "metadata")
$this->assertEquals("array", $service->getType()); $this->assertEquals("array", $service->getType());
elseif ($key === "query") elseif ($key === "query")
@@ -155,17 +129,13 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("xcache", $service->getType()); $this->assertEquals("xcache", $service->getType());
} }
} }
else else {
{ try {
try
{
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("An exception should be raised"); $this->fail("An exception should be raised");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -173,50 +143,40 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
public function testExceptionUnknowLogService() public function testExceptionUnknowLogService()
{ {
try try {
{
$this->options["log"] = "unknowLogger"; $this->options["log"] = "unknowLogger";
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
public function testExceptionMissingDbal() public function testExceptionMissingDbal()
{ {
try try {
{
unset($this->options["dbal"]); unset($this->options["dbal"]);
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
public function testExceptionUnknowDbal() public function testExceptionUnknowDbal()
{ {
try try {
{
$this->options["dbal"] = "unknowDbal"; $this->options["dbal"] = "unknowDbal";
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$core, $this->options self::$core, $this->options
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class ServiceAbstractTest extends PhraseanetPHPUnitAbstract class ServiceAbstractTest extends PhraseanetPHPUnitAbstract
{ {
/** /**
* *
* @var \Alchemy\Phrasea\Core\Service\ServiceAbstract * @var \Alchemy\Phrasea\Core\Service\ServiceAbstract
@@ -45,5 +29,4 @@ class ServiceAbstractTest extends PhraseanetPHPUnitAbstract
$this->assertTrue(is_array($this->object->getOptions())); $this->assertTrue(is_array($this->object->getOptions()));
$this->assertEquals(array('option' => 'my_options'), $this->object->getOptions()); $this->assertEquals(array('option' => 'my_options'), $this->object->getOptions());
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class TwigTest extends PhraseanetPHPUnitAbstract class TwigTest extends PhraseanetPHPUnitAbstract
{ {
protected $options; protected $options;
public function setUp() public function setUp()
@@ -27,10 +11,10 @@ class TwigTest extends PhraseanetPHPUnitAbstract
parent::setUp(); parent::setUp();
$this->options = array( $this->options = array(
'debug' => true 'debug' => true
,'charset' => 'utf-8' , 'charset' => 'utf-8'
,'strict_variables' => true , 'strict_variables' => true
,'autoescape' => true , 'autoescape' => true
,'optimizer' => true , 'optimizer' => true
); );
} }
@@ -60,5 +44,4 @@ class TwigTest extends PhraseanetPHPUnitAbstract
$this->assertEquals("twig", $doctrine->getType()); $this->assertEquals("twig", $doctrine->getType());
} }
} }

View File

@@ -1,29 +1,13 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class AbstractBuilderTest extends PhraseanetPHPUnitAbstract class AbstractBuilderTest extends PhraseanetPHPUnitAbstract
{ {
public function testConstructExceptionNameEmpty() public function testConstructExceptionNameEmpty()
{ {
try try {
{
$stub = $this->getMock( $stub = $this->getMock(
"\Alchemy\Phrasea\Core\Service\Builder" "\Alchemy\Phrasea\Core\Service\Builder"
, array( , array(
@@ -33,17 +17,14 @@ class AbstractBuilderTest extends PhraseanetPHPUnitAbstract
) )
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
public function testConstructExceptionCreate() public function testConstructExceptionCreate()
{ {
try try {
{
$stub = $this->getMock( $stub = $this->getMock(
"\\Alchemy\\Phrasea\\Core\\Service\\Builder" "\\Alchemy\\Phrasea\\Core\\Service\\Builder"
, array( , array(
@@ -53,11 +34,8 @@ class AbstractBuilderTest extends PhraseanetPHPUnitAbstract
) )
); );
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class CacheBuilderTest extends PhraseanetPHPUnitAbstract class CacheBuilderTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,13 +11,10 @@ class CacheBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow") array("type" => "unknow")
); );
try try {
{
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised"); $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); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service); $this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class LogBuilderTest extends PhraseanetPHPUnitAbstract class LogBuilderTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,13 +11,10 @@ class LogBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow", "options" => array()) array("type" => "unknow", "options" => array())
); );
try try {
{
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised"); $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); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service); $this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class OrmBuilderTest extends PhraseanetPHPUnitAbstract class OrmBuilderTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,13 +11,10 @@ class OrmBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow", "options" => array()) array("type" => "unknow", "options" => array())
); );
try try {
{
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised"); $this->fail("An exception should be raised");
} } catch (\Exception $e) {
catch (\Exception $e)
{
} }
} }
@@ -44,7 +26,7 @@ class OrmBuilderTest extends PhraseanetPHPUnitAbstract
$configuration = new Symfony\Component\DependencyInjection\ParameterBag\ParameterBag( $configuration = new Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(
array("type" => "Orm\\Doctrine", "options" => array( array("type" => "Orm\\Doctrine", "options" => array(
"debug" => false "debug" => false
, "log" => array('service'=>"Log\\query_logger") , "log" => array('service' => "Log\\query_logger")
, "dbal" => "main_connexion" , "dbal" => "main_connexion"
, "cache" => array( , "cache" => array(
"metadata" => "Cache\\array_cache" "metadata" => "Cache\\array_cache"
@@ -58,5 +40,4 @@ class OrmBuilderTest extends PhraseanetPHPUnitAbstract
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service); $this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
} }
} }

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class TemplateBuilderTest extends PhraseanetPHPUnitAbstract class TemplateBuilderTest extends PhraseanetPHPUnitAbstract
{ {
@@ -26,13 +11,10 @@ class TemplateBuilderTest extends PhraseanetPHPUnitAbstract
array("type" => "unknow", "options" => array()) array("type" => "unknow", "options" => array())
); );
try try {
{
$service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->fail("An exception should be raised"); $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); $service = Alchemy\Phrasea\Core\Service\Builder::create(self::$core, $configuration);
$this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service); $this->assertInstanceOf("\Alchemy\Phrasea\Core\Service\ServiceAbstract", $service);
} }
} }

View File

@@ -1,24 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Core\Version;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class VersionTest extends \PhraseanetPHPUnitAbstract class VersionTest extends \PhraseanetPHPUnitAbstract
{ {

View File

@@ -1,22 +1,7 @@
<?php <?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'; require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class CoreTest extends PhraseanetPHPUnitAbstract class CoreTest extends PhraseanetPHPUnitAbstract
{ {
@@ -107,8 +92,7 @@ class CoreTest extends PhraseanetPHPUnitAbstract
public function testNotInstalled() public function testNotInstalled()
{ {
if (!extension_loaded('test_helpers')) if ( ! extension_loaded('test_helpers')) {
{
$this->markTestSkipped("test_helpers extension required"); $this->markTestSkipped("test_helpers extension required");
} }
@@ -136,11 +120,9 @@ class CoreTest extends PhraseanetPHPUnitAbstract
protected function newCallback($className) protected function newCallback($className)
{ {
switch ($className) switch ($className) {
{
case 'Alchemy\Phrasea\Core\Configuration': return 'ConfMock'; case 'Alchemy\Phrasea\Core\Configuration': return 'ConfMock';
default: return $className; 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('config', $autoloader->getPaths());
$this->assertArrayHasKey('library', $autoloader->getPaths()); $this->assertArrayHasKey('library', $autoloader->getPaths());
} }
} }

View File

@@ -1,25 +1,9 @@
<?php <?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'; require_once __DIR__ . '/../../../PhraseanetPHPUnitAbstract.class.inc';
class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
{ {
private $apc = false; private $apc = false;
private $xcache = false; private $xcache = false;
@@ -27,28 +11,22 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
{ {
parent::setUp(); parent::setUp();
if (extension_loaded('apc')) if (extension_loaded('apc')) {
{
$this->apc = true; $this->apc = true;
} }
if (extension_loaded('xcache')) if (extension_loaded('xcache')) {
{
$this->xcache = true; $this->xcache = true;
} }
} }
public function testConstruct() public function testConstruct()
{ {
if (!$this->apc && !$this->xcache) if ( ! $this->apc && ! $this->xcache) {
{ try {
try
{
$autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_'); $autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_');
$this->fail("should raise an exception"); $this->fail("should raise an exception");
} } catch (\Exception $e) {
catch(\Exception $e)
{
} }
} }
@@ -56,14 +34,10 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testFindFileApc() public function testFindFileApc()
{ {
if ($this->apc) if ($this->apc) {
{ if ( ! (ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli')))
{
$this->markTestSkipped('The apc extension is available, but not enabled.'); $this->markTestSkipped('The apc extension is available, but not enabled.');
} } else {
else
{
apc_clear_cache('user'); apc_clear_cache('user');
} }
@@ -75,8 +49,7 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testGetPrefix() public function testGetPrefix()
{ {
if ($this->apc) if ($this->apc) {
{
$autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_'); $autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_');
$this->assertEquals('test_prefix_', $autoloader->getPrefix()); $this->assertEquals('test_prefix_', $autoloader->getPrefix());
} }
@@ -84,14 +57,10 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testRegister() public function testRegister()
{ {
if ($this->apc) if ($this->apc) {
{ if ( ! (ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli')))
{
$this->markTestSkipped('The apc extension is available, but not enabled.'); $this->markTestSkipped('The apc extension is available, but not enabled.');
} } else {
else
{
apc_clear_cache('user'); apc_clear_cache('user');
} }
$autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_'); $autoloader = new Alchemy\Phrasea\Loader\CacheAutoloader('test_prefix_');
@@ -103,19 +72,16 @@ class CacheAutoloaderTest extends \PhraseanetPHPUnitAbstract
public function testFindFileXcache() public function testFindFileXcache()
{ {
if ($this->xcache) if ($this->xcache) {
{
$this->marktestSkipped("can't use xcache in cli mode"); $this->marktestSkipped("can't use xcache in cli mode");
} }
} }
public function tearDown() 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'); apc_clear_cache('user');
} }
parent::tearDown(); parent::tearDown();
} }
} }

View File

@@ -1,21 +1,5 @@
<?php <?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 class Test_hello
{ {

View File

@@ -1,21 +1,5 @@
<?php <?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 class HelloCache
{ {

View File

@@ -1,21 +1,5 @@
<?php <?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 class Test_test
{ {

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class AudioTest extends \PHPUnit_Framework_TestCase class AudioTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var Audio * @var Audio
*/ */
@@ -38,5 +37,4 @@ class AudioTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Audio', $this->object->getMediaAlchemystSpec()); $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 class FlexPaperTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var FlexPaper * @var FlexPaper
*/ */
@@ -38,5 +37,4 @@ class FlexPaperTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Flash', $this->object->getMediaAlchemystSpec()); $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 class GifTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var Gif * @var Gif
*/ */
@@ -38,5 +37,4 @@ class GifTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Animation', $this->object->getMediaAlchemystSpec()); $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 class ImageTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var Image * @var Image
*/ */
@@ -38,5 +37,4 @@ class ImageTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Image', $this->object->getMediaAlchemystSpec()); $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 class BooleanTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var Boolean * @var Boolean
*/ */
@@ -49,5 +48,4 @@ class BooleanTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertEquals('Booleen', $this->object->getDisplayName()); $this->assertEquals('Booleen', $this->object->getDisplayName());
} }
} }

View File

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

View File

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

View File

@@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Media\Subdef;
class ProviderTest extends \PHPUnit_Framework_TestCase class ProviderTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var Provider * @var Provider
*/ */
@@ -22,8 +21,7 @@ class ProviderTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertTrue(is_array($this->object->getOptions())); $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); $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); $option = $this->object->getOption(Image::OPTION_SIZE);
$this->assertEquals(300, $option->getValue()); $this->assertEquals(300, $option->getValue());
} }
} }

View File

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

View File

@@ -4,7 +4,6 @@ require_once __DIR__ . '/../../../../PhraseanetPHPUnitAbstract.class.inc';
class UserProviderTest extends \PhraseanetPHPUnitAbstract class UserProviderTest extends \PhraseanetPHPUnitAbstract
{ {
/** /**
* @var UserProvider * @var UserProvider
*/ */
@@ -12,6 +11,7 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
public function setUp() public function setUp()
{ {
parent::setUp();
$this->object = new \Alchemy\Phrasea\Vocabulary\ControlProvider\UserProvider(); $this->object = new \Alchemy\Phrasea\Vocabulary\ControlProvider\UserProvider();
} }
@@ -65,27 +65,20 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
public function testGetValue() public function testGetValue()
{ {
try try {
{
$this->object->getValue(-200); $this->object->getValue(-200);
$this->fail('Should raise an exception'); $this->fail('Should raise an exception');
} } catch (\Exception $e) {
catch(\Exception $e)
{
} }
try try {
{
$this->object->getValue('A'); $this->object->getValue('A');
$this->fail('Should raise an exception'); $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())); $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); $this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\UserProvider', $provider);
try try {
{
$provider = \Alchemy\Phrasea\Vocabulary\Controller::get('Zebulon'); $provider = \Alchemy\Phrasea\Vocabulary\Controller::get('Zebulon');
$this->fail('Should raise an exception'); $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)); $this->assertTrue(is_array($available));
foreach($available as $controller) foreach ($available as $controller) {
{
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\ControlProviderInterface', $controller); $this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\ControlProviderInterface', $controller);
} }
} }
} }

View File

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

View File

@@ -9,9 +9,8 @@ class Bridge_Api_Auth_AbstractTest extends PHPUnit_Framework_TestCase
public function testSet_settings() public function testSet_settings()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_Auth_Abstract'); $stub = $this->getMockForAbstractClass('Bridge_Api_Auth_Abstract');
$setting = $this->getMock("Bridge_AccountSettings", array(), array(), '' , false); $setting = $this->getMock("Bridge_AccountSettings", array(), array(), '', false);
$return = $stub->set_settings($setting); $return = $stub->set_settings($setting);
$this->assertEquals($stub, $return); $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 class Bridge_Api_Auth_FlickrTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Auth_Flickr * @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());
$this->assertEquals("une_super_url", $stub->get_auth_url($params)); $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 class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Auth_OAuth2 * @var Bridge_Api_Auth_OAuth2
*/ */
@@ -27,7 +26,6 @@ class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
); );
} }
public function testParse_request_token() public function testParse_request_token()
{ {
$this->object->set_parameters($this->parameters); $this->object->set_parameters($this->parameters);
@@ -84,7 +82,7 @@ class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
$setting->expects($this->any()) $setting->expects($this->any())
->method("get") ->method("get")
->with($this->equalTo("auth_token")) ->with($this->equalTo("auth_token"))
->will($this->onConsecutiveCalls("123456",123456, null)); ->will($this->onConsecutiveCalls("123456", 123456, null));
$this->object->set_settings($setting); $this->object->set_settings($setting);
@@ -108,21 +106,21 @@ class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $return); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $return);
$this->assertArrayHasKey("auth_token", $return); $this->assertArrayHasKey("auth_token", $return);
$this->assertEquals("123" , $return["auth_token"]); $this->assertEquals("123", $return["auth_token"]);
} }
public function testSet_parameters() public function testSet_parameters()
{ {
$parameters = array( $parameters = array(
"client_id" => "cid" "client_id" => "cid"
,"allo"=>"hello" , "allo" => "hello"
,"yo" => "coucou" , "yo" => "coucou"
,"response_type" => "hihi" , "response_type" => "hihi"
); );
$return = $this->object->set_parameters($parameters); $return = $this->object->set_parameters($parameters);
$this->assertEquals(0 , sizeof(get_object_vars($this->object))); $this->assertEquals(0, sizeof(get_object_vars($this->object)));
$this->assertEquals($return, $this->object); $this->assertEquals($return, $this->object);
} }
@@ -133,10 +131,9 @@ class Bridge_Api_Auth_OAuth2Test extends PHPUnit_Framework_TestCase
$this->assertEquals($expected_url, $this->object->get_auth_url()); $this->assertEquals($expected_url, $this->object->get_auth_url());
$more_params = array("test" => "test"); $more_params = array("test" => "test");
$this->assertEquals($expected_url."&test=test", $this->object->get_auth_url($more_params)); $this->assertEquals($expected_url . "&test=test", $this->object->get_auth_url($more_params));
$more_params = array("response_type" => "test"); $more_params = array("response_type" => "test");
$this->assertNotEquals($expected_url, $this->object->get_auth_url($more_params)); $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 class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_AbstractCollection * @var Bridge_Api_AbstractCollection
*/ */
protected $object; 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() public function testGet_total_items()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertEquals(3, $stub->get_total_items());
} }
/**
* @todo Implement testSet_total_items().
*/
public function testSet_total_items() public function testSet_total_items()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -48,9 +27,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals($return, $stub); $this->assertEquals($return, $stub);
} }
/**
* @todo Implement testGet_items_per_page().
*/
public function testGet_items_per_page() public function testGet_items_per_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertEquals(3, $stub->get_items_per_page());
} }
/**
* @todo Implement testSet_items_per_page().
*/
public function testSet_items_per_page() public function testSet_items_per_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -71,9 +44,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertEquals($return, $stub); $this->assertEquals($return, $stub);
} }
/**
* @todo Implement testGet_current_page().
*/
public function testGet_current_page() public function testGet_current_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertEquals(3, $stub->get_current_page());
} }
/**
* @todo Implement testSet_current_page().
*/
public function testSet_current_page() public function testSet_current_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertEquals(3, $stub->get_current_page());
} }
/**
* @todo Implement testGet_total_page().
*/
public function testGet_total_page() public function testGet_total_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertEquals(3, $stub->get_total_page());
} }
/**
* @todo Implement testSet_total_page().
*/
public function testSet_total_page() public function testSet_total_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertEquals(3, $stub->get_total_page());
} }
/**
* @todo Implement testHas_next_page().
*/
public function testHas_next_page() public function testHas_next_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -138,9 +96,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertFalse($stub->has_next_page()); $this->assertFalse($stub->has_next_page());
} }
/**
* @todo Implement testHas_previous_page().
*/
public function testHas_previous_page() public function testHas_previous_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
@@ -152,9 +107,6 @@ class Bridge_Api_AbstractCollectionTest extends PHPUnit_Framework_TestCase
$this->assertFalse($stub->has_previous_page()); $this->assertFalse($stub->has_previous_page());
} }
/**
* @todo Implement testHas_more_than_one_page().
*/
public function testHas_more_than_one_page() public function testHas_more_than_one_page()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $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()); $this->assertFalse($stub->has_more_than_one_page());
} }
/**
* @todo Implement testGet_elements().
*/
public function testGet_elements() public function testGet_elements()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection'); $stub = $this->getMockForAbstractClass('Bridge_Api_AbstractCollection');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $stub->get_elements()); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $stub->get_elements());
$this->assertEquals(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 class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
{ {
public static $account = null; public static $account = null;
public static $api = null; public static $api = null;
@@ -16,51 +15,35 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAuthenticatedAbstract
public function setUp() public function setUp()
{ {
parent::setUp();
$this->auth = $this->getMock("Bridge_Api_Auth_Interface"); $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() public static function setUpBeforeClass()
{ {
parent::setUpBeforeClass(); parent::setUpBeforeClass();
try try {
{
self::$api = Bridge_Api::get_by_api_name(appbox::get_instance(\bootstrap::getCore()), 'apitest'); 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'); 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'); 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'); self::$account = Bridge_Account::create(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo', 'coucou');
} }
} }
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
parent::tearDownAfterClass();
self::$api->delete(); self::$api->delete();
if (self::$account instanceof Bridge_Account) if (self::$account instanceof Bridge_Account) {
self::$account->delete(); self::$account->delete();
} }
parent::tearDownAfterClass();
}
/**
* @todo Implement testSet_auth_settings().
*/
public function testSet_auth_settings() public function testSet_auth_settings()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract")); $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); $this->assertEquals($stub, $return);
} }
/**
* @todo Implement testConnect().
*/
public function testConnectGood() 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")); $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(); $stub->connect();
} }
/**
* @todo Implement testReconnect().
*/
public function 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")); $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); $this->assertEquals($stub, $return);
} }
/**
* @todo Implement testReconnect().
*/
public function testReconnectBad() 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")); $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(); $stub->reconnect();
} }
/**
* @todo Implement testDisconnect().
*/
public function 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")); $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); $this->assertEquals($stub, $return);
} }
/**
* @todo Implement testDisconnect().
*/
public function testDisconnectBad() 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")); $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(); $stub->disconnect();
} }
/**
* @todo Implement testIs_connected().
*/
public function testIs_connected() public function testIs_connected()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract")); $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); $this->assertEquals(TRUE, $return);
} }
/**
* @todo Implement testGet_auth_url().
*/
public function testGet_auth_url() public function testGet_auth_url()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract")); $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); $this->assertEquals("une url", $return);
} }
/**
* @todo Implement testSet_locale().
*/
public function testSet_locale() public function testSet_locale()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract")); $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()); $this->assertEquals("fr", $stub->get_locale());
} }
/**
* @todo Implement testIs_valid_object_id().
*/
public function 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")); $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)); $this->assertFalse($stub->is_valid_object_id(true));
} }
/**
* @todo Implement testHandle_exception().
*/
public function testHandle_exception() public function testHandle_exception()
{ {
$stub = $this->getMockForAbstractClass('Bridge_Api_Abstract', array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract")); $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); $void = $stub->handle_exception($e);
$this->assertNull($void); $this->assertNull($void);
} }
} }

View File

@@ -5,17 +5,16 @@ require_once __DIR__ . '/../Bridge_datas.inc';
class Bridge_Api_ContainerCollectionTest extends PHPUnit_Framework_TestCase class Bridge_Api_ContainerCollectionTest extends PHPUnit_Framework_TestCase
{ {
public function testAdd_element() public function testAdd_element()
{ {
$collection = new Bridge_Api_ContainerCollection(); $collection = new Bridge_Api_ContainerCollection();
$i = 0; $i = 0;
while($i < 5) while ($i < 5) {
{
$container = $this->getMock("Bridge_Api_ContainerInterface"); $container = $this->getMock("Bridge_Api_ContainerInterface");
$collection->add_element(new $container); $collection->add_element(new $container);
$i++; $i ++;
} }
$this->assertEquals(5, sizeof($collection->get_elements())); $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(); $collection = new Bridge_Api_ElementCollection();
$i = 0; $i = 0;
while($i < 5) while ($i < 5) {
{
$element = $this->getMock("Bridge_Api_ElementInterface"); $element = $this->getMock("Bridge_Api_ElementInterface");
$collection->add_element(new $element); $collection->add_element(new $element);
$i++; $i ++;
} }
$this->assertEquals(5, sizeof($collection->get_elements())); $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 <?php
require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc'; require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
require_once __DIR__ . '/../../Bridge_datas.inc'; require_once __DIR__ . '/../../Bridge_datas.inc';
require_once __DIR__ . '/../../../../lib/classes/Bridge/Api/Dailymotion/Container.class.php'; require_once __DIR__ . '/../../../../lib/classes/Bridge/Api/Dailymotion/Container.class.php';
class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Dailymotion_Container * @var Bridge_Api_Dailymotion_Container
*/ */
@@ -15,23 +15,17 @@ class Bridge_Api_Dailymotion_ContainerTest extends PHPUnit_Framework_TestCase
{ {
$this->test = array( $this->test = array(
'id' => '01234567' 'id' => '01234567'
,'description' => 'one description' , 'description' => 'one description'
, 'name' => 'hello container' , 'name' => 'hello container'
); );
} }
/**
* @todo Implement testGet_created_on().
*/
public function testGet_created_on() public function testGet_created_on()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertNull($this->object->get_created_on()); $this->assertNull($this->object->get_created_on());
} }
/**
* @todo Implement testGet_description().
*/
public function testGet_description() public function testGet_description()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $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()); $this->assertEmpty($this->object->get_description());
} }
/**
* @todo Implement testGet_id().
*/
public function testGet_id() public function testGet_id()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $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()); $this->assertEmpty($this->object->get_id());
} }
/**
* @todo Implement testGet_thumbnail().
*/
public function testGet_thumbnail() public function testGet_thumbnail()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertEquals('thumb', $this->object->get_thumbnail()); $this->assertEquals('thumb', $this->object->get_thumbnail());
} }
/**
* @todo Implement testGet_title().
*/
public function testGet_title() public function testGet_title()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $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()); $this->assertEmpty($this->object->get_title());
} }
/**
* @todo Implement testGet_type().
*/
public function testGet_type() public function testGet_type()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertEquals('playlist', $this->object->get_type()); $this->assertEquals('playlist', $this->object->get_type());
} }
/**
* @todo Implement testGet_updated_on().
*/
public function testGet_updated_on() public function testGet_updated_on()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertNull($this->object->get_updated_on()); $this->assertNull($this->object->get_updated_on());
} }
/**
* @todo Implement testGet_url().
*/
public function testGet_url() public function testGet_url()
{ {
$this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url'); $this->object = new Bridge_Api_Dailymotion_Container($this->test, 'playlist', 'thumb', 'url');
$this->assertEquals('url', $this->object->get_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 class Bridge_Api_Dailymotion_ElementTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Dailymotion_Element * @var Bridge_Api_Dailymotion_Element
*/ */
@@ -133,7 +132,7 @@ class Bridge_Api_Dailymotion_ElementTest extends PHPUnit_Framework_TestCase
unset($this->test["views_total"]); unset($this->test["views_total"]);
$this->object = new Bridge_Api_Dailymotion_Element($this->test, 'blabla'); $this->object = new Bridge_Api_Dailymotion_Element($this->test, 'blabla');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_INT, $this->object->get_view_count()); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_INT, $this->object->get_view_count());
$this->assertEquals(0 , $this->object->get_view_count()); $this->assertEquals(0, $this->object->get_view_count());
} }
public function testGet_rating() public function testGet_rating()
@@ -144,7 +143,7 @@ class Bridge_Api_Dailymotion_ElementTest extends PHPUnit_Framework_TestCase
unset($this->test["ratings_total"]); unset($this->test["ratings_total"]);
$this->object = new Bridge_Api_Dailymotion_Element($this->test, 'blabla'); $this->object = new Bridge_Api_Dailymotion_Element($this->test, 'blabla');
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_INT, $this->object->get_rating()); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_INT, $this->object->get_rating());
$this->assertEquals(0 , $this->object->get_rating()); $this->assertEquals(0, $this->object->get_rating());
} }
public function testGet_category() public function testGet_category()
@@ -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->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object->get_category());
$this->assertEmpty($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 class Bridge_Api_Flickr_ContainerTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Flickr_Container * @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->assertEquals("photoset", $this->object->get_type());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $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 class Bridge_Api_Flickr_ElementTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Flickr_Element * @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_alone->get_type());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $this->object_list->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 class Bridge_Api_Youtube_ContainerTest extends PHPUnit_Framework_TestCase
{ {
/** /**
* @var Bridge_Api_Youtube_Container * @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'); $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() public function testGet_thumbnail()
{ {
$this->assertEquals("my_thumbnail", $this->object->get_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->assertEquals("playlist", $this->object->get_type());
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $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