This commit is contained in:
Romain Neutron
2012-04-14 12:18:29 +02:00
parent 855fd91081
commit cc42055f4d
8 changed files with 131 additions and 194 deletions

View File

@@ -2,10 +2,6 @@
require_once __DIR__ . '/PhraseanetPHPUnitAuthenticatedAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
/**
* Test class for searchEngine_options.
* Generated by PHPUnit on 2012-01-11 at 15:13:53.
*/
class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
{ {
@@ -14,24 +10,11 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
*/ */
protected $object; protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp() public function setUp()
{ {
$this->object = new searchEngine_options(); $this->object = new searchEngine_options();
} }
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
}
public function testSet_locale() public function testSet_locale()
{ {
$locale = 'BABA'; $locale = 'BABA';

View File

@@ -2,10 +2,6 @@
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for setup.
* Generated by PHPUnit on 2011-07-06 at 18:33:21.
*/
class setupTest extends PhraseanetPHPUnitAbstract class setupTest extends PhraseanetPHPUnitAbstract
{ {
@@ -200,4 +196,3 @@ class setupTest extends PhraseanetPHPUnitAbstract
} }
?>

View File

@@ -2,68 +2,62 @@
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for sphinxrt.
* Generated by PHPUnit on 2011-07-06 at 18:31:37.
*/
class sphinxrtTest extends PhraseanetPHPUnitAbstract class sphinxrtTest extends PhraseanetPHPUnitAbstract
{ {
/** /**
* @todo Implement testGet_instance(). * @todo Implement testGet_instance().
*/ */
public function testGet_instance() public function testGet_instance()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }
/** /**
* @todo Implement testDelete(). * @todo Implement testDelete().
*/ */
public function testDelete() public function testDelete()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }
/** /**
* @todo Implement testUpdate_status(). * @todo Implement testUpdate_status().
*/ */
public function testUpdate_status() public function testUpdate_status()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }
/** /**
* @todo Implement testReplace_in_metas(). * @todo Implement testReplace_in_metas().
*/ */
public function testReplace_in_metas() public function testReplace_in_metas()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }
/** /**
* @todo Implement testReplace_in_documents(). * @todo Implement testReplace_in_documents().
*/ */
public function testReplace_in_documents() public function testReplace_in_documents()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
$this->markTestIncomplete( $this->markTestIncomplete(
'This test has not been implemented yet.' 'This test has not been implemented yet.'
); );
} }
} }
?>

View File

@@ -2,20 +2,16 @@
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for thesaurus.
* Generated by PHPUnit on 2011-07-06 at 18:30:03.
*/
class thesaurusTest extends PhraseanetPHPUnitAbstract class thesaurusTest extends PhraseanetPHPUnitAbstract
{ {
public function testXquery_escape() public function testXquery_escape()
{ {
$string = 'Eléphant '; $string = 'Eléphant ';
$this->assertEquals($string, thesaurus::xquery_escape($string)); $this->assertEquals($string, thesaurus::xquery_escape($string));
$string = '&é"\'(-è_ çà)=ù*!:;,?./§%µ+°0987654321'; $string = '&é"\'(-è_ çà)=ù*!:;,?./§%µ+°0987654321';
$this->assertEquals('&é"'(-è_ çà)=ù*!:;,?./§%µ+°0987654321', thesaurus::xquery_escape($string)); $this->assertEquals('&é"'(-è_ çà)=ù*!:;,?./§%µ+°0987654321', thesaurus::xquery_escape($string));
} }
} }

View File

@@ -2,49 +2,44 @@
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for unicode.
* Generated by PHPUnit on 2011-05-27 at 16:32:47.
*/
class unicodeTest extends PhraseanetPHPUnitAbstract class unicodeTest extends PhraseanetPHPUnitAbstract
{ {
/** /**
* @var unicode * @var unicode
*/ */
protected $object; protected $object;
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->object = new unicode(); $this->object = new unicode();
} }
public function testRemove_diacritics() public function testRemove_diacritics()
{ {
$this->assertEquals('Elephant', $this->object->remove_diacritics('Eléphant')); $this->assertEquals('Elephant', $this->object->remove_diacritics('Eléphant'));
$this->assertEquals('&e"\'(-e_ca)=$*u:;,?./§%µ£°0987654321œ3~#{[|^`@]}e³²÷׿', $this->object->remove_diacritics('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿')); $this->assertEquals('&e"\'(-e_ca)=$*u:;,?./§%µ£°0987654321œ3~#{[|^`@]}e³²÷׿', $this->object->remove_diacritics('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿'));
$this->assertEquals('PeTARDS', $this->object->remove_diacritics('PéTARDS')); $this->assertEquals('PeTARDS', $this->object->remove_diacritics('PéTARDS'));
} }
public function testRemove_nonazAZ09() public function testRemove_nonazAZ09()
{ {
$this->assertEquals('Elephant', $this->object->remove_nonazAZ09('Eléphant')); $this->assertEquals('Elephant', $this->object->remove_nonazAZ09('Eléphant'));
$this->assertEquals('e-e_cau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', true, true)); $this->assertEquals('e-e_cau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', true, true));
$this->assertEquals('eecau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', false, false)); $this->assertEquals('eecau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', false, false));
$this->assertEquals('ee_cau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', true, false)); $this->assertEquals('ee_cau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', true, false));
$this->assertEquals('e-ecau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', false, true)); $this->assertEquals('e-ecau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', false, true));
$this->assertEquals('PeTARDS', $this->object->remove_nonazAZ09('PéTARDS')); $this->assertEquals('PeTARDS', $this->object->remove_nonazAZ09('PéTARDS'));
} }
public function testRemove_first_digits()
public function testRemove_first_digits() {
{ $this->assertEquals('', $this->object->remove_first_digits('123456789'));
$this->assertEquals('', $this->object->remove_first_digits('123456789')); $this->assertEquals('abcdeé', $this->object->remove_first_digits('12345abcdeé'));
$this->assertEquals('abcdeé', $this->object->remove_first_digits('12345abcdeé')); $this->assertEquals('abcdeé0987', $this->object->remove_first_digits('abcdeé0987'));
$this->assertEquals('abcdeé0987', $this->object->remove_first_digits('abcdeé0987')); $this->assertEquals('a2b5cdeé', $this->object->remove_first_digits('4a2b5cdeé'));
$this->assertEquals('a2b5cdeé', $this->object->remove_first_digits('4a2b5cdeé')); }
}
} }

View File

@@ -1,32 +1,29 @@
<?php <?php
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for random.
* Generated by PHPUnit on 2011-05-27 at 18:41:53.
*/
class unitTestsTest extends PhraseanetPHPUnitAbstract class unitTestsTest extends PhraseanetPHPUnitAbstract
{ {
public function testFiles() public function testFiles()
{
$testDir = __DIR__.'/';
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
{ {
if (strpos($file, '/.svn/') !== false) $testDir = __DIR__ . '/';
continue; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
if (substr($file->getFilename(), 0, 1) === '.') {
continue; if (strpos($file, '/.svn/') !== false)
if (substr($file->getFilename(), -4) !== '.php') continue;
continue; if (substr($file->getFilename(), 0, 1) === '.')
if (substr($file->getFilename(), -9) === 'class.php') continue;
continue; if (substr($file->getFilename(), -4) !== '.php')
if($file->getFilename() === "BoilerPlate.php") continue;
continue; if (substr($file->getFilename(), -9) === 'class.php')
continue;
if ($file->getFilename() === "BoilerPlate.php")
continue;
$this->assertRegExp('/[a-zA-Z0-9-_\.]+Test.php/', $file->getPathname(), 'Verify that all tests files names'); $this->assertRegExp('/[a-zA-Z0-9-_\.]+Test.php/', $file->getPathname(), 'Verify that all tests files names');
}
} }
}
} }

View File

@@ -1,59 +1,40 @@
<?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 userTest extends PhraseanetPHPUnitAbstract class userTest extends PhraseanetPHPUnitAbstract
{ {
public function testMail()
public function testMail()
{
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
try
{ {
$appbox = appbox::get_instance(\bootstrap::getCore()); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
try
{
$appbox = appbox::get_instance(\bootstrap::getCore());
self::$user->set_email(null); self::$user->set_email(null);
$this->assertFalse(User_Adapter::get_usr_id_from_email(null)); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email(''); self::$user->set_email('');
$this->assertFalse(User_Adapter::get_usr_id_from_email(null)); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('noone@example.com'); self::$user->set_email('noone@example.com');
$this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com')); $this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com'));
} }
catch(Exception $e) catch (Exception $e)
{ {
$this->fail($e->getMessage()); $this->fail($e->getMessage());
} }
try try
{ {
self::$user->set_email('noonealt1@example.com'); self::$user->set_email('noonealt1@example.com');
$this->fail('A user already got this address'); $this->fail('A user already got this address');
} }
catch(Exception $e) catch (Exception $e)
{ {
}
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
} }
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
}
} }

View File

@@ -2,10 +2,6 @@
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc'; require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
* Test class for uuid.
* Generated by PHPUnit on 2011-05-27 at 14:58:30.
*/
class uuidTest extends PhraseanetPHPUnitAbstract class uuidTest extends PhraseanetPHPUnitAbstract
{ {