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';
/**
* Test class for searchEngine_options.
* Generated by PHPUnit on 2012-01-11 at 15:13:53.
*/
class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
@@ -14,24 +10,11 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
$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()
{
$locale = 'BABA';

View File

@@ -2,10 +2,6 @@
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
{
@@ -200,4 +196,3 @@ class setupTest extends PhraseanetPHPUnitAbstract
}
?>

View File

@@ -2,68 +2,62 @@
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
{
/**
* @todo Implement testGet_instance().
*/
public function testGet_instance()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGet_instance().
*/
public function testGet_instance()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testDelete().
*/
public function testDelete()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpdate_status().
*/
public function testUpdate_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testUpdate_status().
*/
public function testUpdate_status()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReplace_in_metas().
*/
public function testReplace_in_metas()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReplace_in_metas().
*/
public function testReplace_in_metas()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReplace_in_documents().
*/
public function testReplace_in_documents()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testReplace_in_documents().
*/
public function testReplace_in_documents()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
}
?>

View File

@@ -2,20 +2,16 @@
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
{
public function testXquery_escape()
{
$string = 'Eléphant ';
$this->assertEquals($string, thesaurus::xquery_escape($string));
$string = '&é"\'(-è_ çà)=ù*!:;,?./§%µ+°0987654321';
$this->assertEquals('&é"'(-è_ çà)=ù*!:;,?./§%µ+°0987654321', thesaurus::xquery_escape($string));
}
public function testXquery_escape()
{
$string = 'Eléphant ';
$this->assertEquals($string, thesaurus::xquery_escape($string));
$string = '&é"\'(-è_ çà)=ù*!:;,?./§%µ+°0987654321';
$this->assertEquals('&é"'(-è_ çà)=ù*!:;,?./§%µ+°0987654321', thesaurus::xquery_escape($string));
}
}

View File

@@ -2,49 +2,44 @@
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
{
/**
* @var unicode
*/
protected $object;
/**
* @var unicode
*/
protected $object;
public function setUp()
{
parent::setUp();
$this->object = new unicode();
}
public function setUp()
{
parent::setUp();
$this->object = new unicode();
}
public function testRemove_diacritics()
{
$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('PeTARDS', $this->object->remove_diacritics('PéTARDS'));
}
public function testRemove_diacritics()
{
$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('PeTARDS', $this->object->remove_diacritics('PéTARDS'));
}
public function testRemove_nonazAZ09()
{
$this->assertEquals('Elephant', $this->object->remove_nonazAZ09('Eléphant'));
$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('ee_cau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', true, false));
$this->assertEquals('e-ecau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', false, true));
$this->assertEquals('PeTARDS', $this->object->remove_nonazAZ09('PéTARDS'));
}
public function testRemove_nonazAZ09()
{
$this->assertEquals('Elephant', $this->object->remove_nonazAZ09('Eléphant'));
$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('ee_cau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', true, false));
$this->assertEquals('e-ecau09876543213e', $this->object->remove_nonazAZ09('&é"\'(-è_çà)=$*ù:;,?./§%µ£°0987654321Œ3~#{[|^`@]}ê³²÷׿', false, true));
$this->assertEquals('PeTARDS', $this->object->remove_nonazAZ09('PéTARDS'));
}
public function testRemove_first_digits()
{
$this->assertEquals('', $this->object->remove_first_digits('123456789'));
$this->assertEquals('abcdeé', $this->object->remove_first_digits('12345abcdeé'));
$this->assertEquals('abcdeé0987', $this->object->remove_first_digits('abcdeé0987'));
$this->assertEquals('a2b5cdeé', $this->object->remove_first_digits('4a2b5cdeé'));
}
public function testRemove_first_digits()
{
$this->assertEquals('', $this->object->remove_first_digits('123456789'));
$this->assertEquals('abcdeé', $this->object->remove_first_digits('12345abcdeé'));
$this->assertEquals('abcdeé0987', $this->object->remove_first_digits('abcdeé0987'));
$this->assertEquals('a2b5cdeé', $this->object->remove_first_digits('4a2b5cdeé'));
}
}

View File

@@ -1,32 +1,29 @@
<?php
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
{
public function testFiles()
{
$testDir = __DIR__.'/';
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
public function testFiles()
{
if (strpos($file, '/.svn/') !== false)
continue;
if (substr($file->getFilename(), 0, 1) === '.')
continue;
if (substr($file->getFilename(), -4) !== '.php')
continue;
if (substr($file->getFilename(), -9) === 'class.php')
continue;
if($file->getFilename() === "BoilerPlate.php")
continue;
$testDir = __DIR__ . '/';
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($testDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file)
{
if (strpos($file, '/.svn/') !== false)
continue;
if (substr($file->getFilename(), 0, 1) === '.')
continue;
if (substr($file->getFilename(), -4) !== '.php')
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
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class userTest extends PhraseanetPHPUnitAbstract
{
public function testMail()
{
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
try
public function testMail()
{
$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));
self::$user->set_email('');
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('noone@example.com');
$this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com'));
}
catch(Exception $e)
{
$this->fail($e->getMessage());
}
try
{
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('');
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('noone@example.com');
$this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com'));
}
catch (Exception $e)
{
$this->fail($e->getMessage());
}
try
{
self::$user->set_email('noonealt1@example.com');
$this->fail('A user already got this address');
}
catch(Exception $e)
{
self::$user->set_email('noonealt1@example.com');
$this->fail('A user already got this address');
}
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';
/**
* Test class for uuid.
* Generated by PHPUnit on 2011-05-27 at 14:58:30.
*/
class uuidTest extends PhraseanetPHPUnitAbstract
{