mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Remove annotation
This commit is contained in:
parent
69ee452af7
commit
c316c1715a
|
|
@ -165,29 +165,26 @@ class AccountTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($datetime->format('Y-m-d h:i:s'), $account->getLastActive()->format('Y-m-d h:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testEmailException() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$account = new Account();
|
||||
$account->setEmail('d.duck!@#%@duckburg');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testStatusException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$account = new Account();
|
||||
$account->setStatus(99);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testTypeException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$account = new Account();
|
||||
$account->setType(99);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,11 +73,10 @@ class GroupTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(GroupStatus::ACTIVE, $group->getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testStatusException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$account = new Group();
|
||||
$account->setStatus(99);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,11 +381,10 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(172.13, FinanceFormulas::getNetPresentValue($c, $r), '', 0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \UnexpectedValueException
|
||||
*/
|
||||
public function testInvalidNetPresentValue() : void
|
||||
{
|
||||
self::expectedException(\UnexpectedValueException::class);
|
||||
|
||||
FinanceFormulas::getNetPresentValue([], 0.1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,11 +54,10 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidCacheType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
ConnectionFactory::create(['type' => 'invalid', 'path' => 'Cache']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,11 +195,10 @@ class FileCacheTest extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidCachePath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$cache = new FileCache('/etc/invalidPathOrPermission^$:?><');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,22 +125,20 @@ class MemCachedTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([], $cache->stats());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidCacheHost() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['cache']['memcached'];
|
||||
unset($db['host']);
|
||||
|
||||
$cache = new MemCached($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidCachePort() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['cache']['memcached'];
|
||||
unset($db['port']);
|
||||
|
||||
|
|
|
|||
|
|
@ -127,33 +127,30 @@ class RedisCacheTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([], $cache->stats());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidCacheHost() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['cache']['redis'];
|
||||
unset($db['host']);
|
||||
|
||||
$cache = new RedisCache($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidCachePort() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['cache']['redis'];
|
||||
unset($db['port']);
|
||||
|
||||
$cache = new RedisCache($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidCacheDatabase() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['cache']['redis'];
|
||||
unset($db['db']);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@ class CookieJarTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($jar->remove('test2'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\LockException
|
||||
*/
|
||||
public function testDeleteLocked() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\LockException::class);
|
||||
|
||||
$jar = new CookieJar();
|
||||
self::assertTrue($jar->set('test', 'value'));
|
||||
|
||||
|
|
@ -55,11 +54,10 @@ class CookieJarTest extends \PHPUnit\Framework\TestCase
|
|||
$jar->delete('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\LockException
|
||||
*/
|
||||
public function testSaveLocked() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\LockException::class);
|
||||
|
||||
CookieJar::lock();
|
||||
|
||||
$jar = new CookieJar();
|
||||
|
|
|
|||
|
|
@ -85,11 +85,10 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidDatabaseType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
ConnectionFactory::create(['db' => 'invalid']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,88 +38,80 @@ class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Grammar\MysqlGrammar', $mysql->getGrammar());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseType() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
unset($db['db']);
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidHost() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
unset($db['host']);
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidPort() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
unset($db['port']);
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabase() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
unset($db['database']);
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidLogin() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
unset($db['login']);
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidPassword() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
unset($db['password']);
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseTypeName() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
$db['db'] = 'invalid';
|
||||
|
||||
$mysql = new MysqlConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseName() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
|
||||
$db['database'] = 'invalid';
|
||||
|
||||
|
|
|
|||
|
|
@ -36,71 +36,64 @@ class PostgresConnectionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Grammar\PostgresGrammar', $psql->getGrammar());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseType() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
unset($db['db']);
|
||||
$psql = new PostgresConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidHost() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
unset($db['host']);
|
||||
$psql = new PostgresConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidPort() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
unset($db['port']);
|
||||
$psql = new PostgresConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabase() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
unset($db['database']);
|
||||
$psql = new PostgresConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidLogin() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
unset($db['login']);
|
||||
$psql = new PostgresConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidPassword() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
unset($db['password']);
|
||||
$psql = new PostgresConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseTypeName() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['postgresql']['admin'];
|
||||
$db['db'] = 'invalid';
|
||||
$psql = new PostgresConnection($db);
|
||||
|
|
|
|||
|
|
@ -34,21 +34,19 @@ class SQLiteConnectionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Grammar\SQLiteGrammar', $sqlite->getGrammar());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseType() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['sqlite']['admin'];
|
||||
unset($db['db']);
|
||||
$sqlite = new SQLiteConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabase() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['sqlite']['admin'];
|
||||
unset($db['database']);
|
||||
$sqlite = new SQLiteConnection($db);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
namespace phpOMS\tests\DataStorage\Database\Connection;
|
||||
|
||||
use phpOMS\DataStorage\Database\Connection\SqlServerConnection;
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
|
||||
class SqlServerConnectionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
|
@ -36,81 +37,73 @@ class SqlServerConnectionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\DataStorage\Database\Query\Grammar\SqlServerGrammar', $psql->getGrammar());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseType() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
unset($db['db']);
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidHost() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
unset($db['host']);
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidPort() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
unset($db['port']);
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabase() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
unset($db['database']);
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidLogin() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
unset($db['login']);
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidPassword() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
unset($db['password']);
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseTypeName() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
$db['db'] = 'invalid';
|
||||
$psql = new SqlServerConnection($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException
|
||||
*/
|
||||
public function testInvalidDatabaseName() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\DataStorage\Database\Exception\InvalidConnectionConfigException::class);
|
||||
|
||||
$db = $GLOBALS['CONFIG']['db']['core']['mssql']['admin'];
|
||||
$db['database'] = 'invalid';
|
||||
|
||||
|
|
|
|||
|
|
@ -304,83 +304,74 @@ class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('SELECT test.val FROM test;', $query->raw('SELECT test.val FROM test;')->toSql());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyRaw() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->raw('DROP DATABASE oms;');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyInsert() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->insert('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyUpdate() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyDelete() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidWhereOperator() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->where('a', 'invalid', 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidJoinTable() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->join(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidJoinOperator() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->join('b')->on('a', 'invalid', 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidOrOrderType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->orderBy('a', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidOrColumnType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new Builder($this->con, true);
|
||||
$query->orderBy(null, 'DESC');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,74 +79,66 @@ class JsonBuilderTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyInsert() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->insert('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyUpdate() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testReadOnlyDelete() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidWhereOperator() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->where('a', 'invalid', 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidJoinTable() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->join(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidJoinOperator() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->join('b')->on('a', 'invalid', 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidOrOrderType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->orderBy('a', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidOrColumnType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$query = new JsonBuilder(true);
|
||||
$query->orderBy(null, 'DESC');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,35 +118,31 @@ class DispatcherTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \UnexpectedValueException
|
||||
*/
|
||||
public function testInvalidDestination() : void
|
||||
{
|
||||
self::expectedException(\UnexpectedValueException::class);
|
||||
|
||||
$this->app->dispatcher->dispatch(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidControllerPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
$this->app->dispatcher->dispatch('phpOMS\tests\Dispatcher\TestControllers::testFunctionStatic');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidControllerFunction() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$this->app->dispatcher->dispatch('phpOMS\tests\Dispatcher\TestController::testFunctionStaticINVALID');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \UnexpectedValueException
|
||||
*/
|
||||
public function testInvalidControllerString() : void
|
||||
{
|
||||
self::expectedException(\UnexpectedValueException::class);
|
||||
|
||||
$this->app->dispatcher->dispatch('phpOMS\tests\Dispatcher\TestController::testFunctionStatic:failure');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,10 @@ class L11nManagerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('ERROR', $l11nManager->getText('en', 'Admin', 'Backend', 'Test2'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidModule() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$expected = [
|
||||
'en' => [
|
||||
'Admin' => [
|
||||
|
|
|
|||
|
|
@ -64,38 +64,34 @@ class LocalizationTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([], $localization->getVolume());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidLanguage() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$localization = new Localization();
|
||||
$localization->setLanguage('abc');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidCountry() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$localization = new Localization();
|
||||
$localization->setCountry('abc');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidTimezone() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$localization = new Localization();
|
||||
$localization->setTimezone('abc');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidCurrency() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$localization = new Localization();
|
||||
$localization->setCurrency('abc');
|
||||
}
|
||||
|
|
@ -153,11 +149,10 @@ class LocalizationTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(ISO4217CharEnum::_USD, $localization->getCurrency());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidLocalizationLoading() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$localization = new Localization();
|
||||
$localization->loadFromLanguage('INVALID');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,11 +147,10 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
|
|||
\ob_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testLogException() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$log = new FileLogger(__DIR__ . '/test.log');
|
||||
$log->log('testException', FileLogger::MSG_FULL, [
|
||||
'message' => 'msg',
|
||||
|
|
|
|||
|
|
@ -75,11 +75,10 @@ class CholeskyDecompositionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([[1], [2], [3]], $cholesky->solve($vec)->toArray(), '', 0.2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimension() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$A = new Matrix();
|
||||
$A->setMatrix([
|
||||
[25, 15, -5],
|
||||
|
|
|
|||
|
|
@ -63,11 +63,10 @@ class LUDecompositionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($lu->isNonSingular());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testSolveOfSingularMatrix() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$B = new Matrix();
|
||||
$B->setMatrix([
|
||||
[25, 15, -5],
|
||||
|
|
@ -103,11 +102,10 @@ class LUDecompositionTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimension() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$B = new Matrix();
|
||||
$B->setMatrix([
|
||||
[25, 15, -5],
|
||||
|
|
|
|||
|
|
@ -269,11 +269,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidSetIndexException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$id = new Matrix();
|
||||
$id->setMatrix([
|
||||
[1, 0],
|
||||
|
|
@ -282,11 +281,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
$id->set(99, 99, 99);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidGetIndexException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$id = new Matrix();
|
||||
$id->setMatrix([
|
||||
[1, 0],
|
||||
|
|
@ -295,11 +293,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
$id->get(99, 99);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidSub() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$id = new Matrix();
|
||||
$id->setMatrix([
|
||||
[1, 0],
|
||||
|
|
@ -309,11 +306,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
$id->sub(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidAdd() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$id = new Matrix();
|
||||
$id->setMatrix([
|
||||
[1, 0],
|
||||
|
|
@ -323,11 +319,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
$id->add(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidMult() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$id = new Matrix();
|
||||
$id->setMatrix([
|
||||
[1, 0],
|
||||
|
|
@ -337,11 +332,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
$id->mult(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimensionAdd() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$A = new Matrix();
|
||||
$A->setMatrix([[1, 2], [3, 4]]);
|
||||
|
||||
|
|
@ -351,11 +345,10 @@ class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
$A->add($B);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimensionSub() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$A = new Matrix();
|
||||
$A->setMatrix([[1, 2], [3, 4]]);
|
||||
|
||||
|
|
|
|||
|
|
@ -107,47 +107,42 @@ class ComplexTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('1.04 + 1.44i', $cpl2->sqrt()->render());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidAdd() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$cpl = new Complex(4, 3);
|
||||
$cpl->add(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidSub() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$cpl = new Complex(4, 3);
|
||||
$cpl->sub(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidMult() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$cpl = new Complex(4, 3);
|
||||
$cpl->mult(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidDiv() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$cpl = new Complex(4, 3);
|
||||
$cpl->div(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidPow() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$cpl = new Complex(4, 3);
|
||||
$cpl->pow(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,11 +38,10 @@ class IntegerTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([59, 101], Integer::fermatFactor(5959));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidFermatParameter() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
Integer::fermatFactor(8);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,35 +66,31 @@ class AverageTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($average, Average::totalMovingAverage($data, 10), '', 0.1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidWeightedAverageDimension() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
Average::weightedAverage([1, 2, 3, 4, 5, 6, 7], [0.1, 0.2, 0.3, 0.1, 0.2, 0.05]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidArithmeticMeanZeroDevision() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
Average::arithmeticMean([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidGeometricMean() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
Average::geometricMean([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidHarmonicMean() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
Average::harmonicMean([1, 2, 3, 0, 5, 6, 7]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@ class LevelLevelRegressionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(0.7273, LevelLevelRegression::getElasticity($this->reg['b1'], 11, 2), '', 0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimension() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$x = [1,2, 3];
|
||||
$y = [1,2, 3, 4];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ class LevelLogRegressionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($this->reg['b1'] / $y, LevelLogRegression::getElasticity($this->reg['b1'], $y, 0), '', 0.2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimension() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$x = [1,2, 3];
|
||||
$y = [1,2, 3, 4];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ class LogLevelRegressionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($this->reg['b1'] * $x, LogLevelRegression::getElasticity($this->reg['b1'], 0, $x), '', 0.2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimension() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$x = [1,2, 3];
|
||||
$y = [1,2, 3, 4];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ class LogLogRegressionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($this->reg['b1'], LogLogRegression::getElasticity($this->reg['b1'], 0, 0), '', 0.2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidDimension() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
$x = [1,2, 3];
|
||||
$y = [1,2, 3, 4];
|
||||
|
||||
|
|
|
|||
|
|
@ -62,43 +62,38 @@ class MeasureOfDispersionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(88, MeasureOfDispersion::getIQR($x));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidEmpiricalVariationCoefficient() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
MeasureOfDispersion::empiricalVariationCoefficient([1, 2, 3, 4, 5, 6, 7], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidEmpiricalCovariance() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
MeasureOfDispersion::empiricalCovariance([], []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Matrix\Exception\InvalidDimensionException
|
||||
*/
|
||||
public function testInvalidEmpiricalCovarianceDimension() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Matrix\Exception\InvalidDimensionException::class);
|
||||
|
||||
MeasureOfDispersion::empiricalCovariance([1, 2, 3, 4], [1, 2, 3]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidSampleVariance() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
MeasureOfDispersion::sampleVariance([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException phpOMS\Math\Exception\ZeroDevisionException
|
||||
*/
|
||||
public function testInvalidEmpiricalVariance() : void
|
||||
{
|
||||
self::expectedException(phpOMS\Math\Exception\ZeroDevisionException::class);
|
||||
|
||||
MeasureOfDispersion::empiricalVariance([]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,35 +92,31 @@ class ChiSquaredDistributionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals((1 - 2 * $t) ** (-$df / 2), ChiSquaredDistribution::getMgf($df, $t));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testHypothesisSizeException() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
ChiSquaredDistribution::testHypothesis([1, 2], [2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testHypothesisDegreesOfFreedomException() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
ChiSquaredDistribution::testHypothesis([], []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testPdfOutOfBoundsException() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
ChiSquaredDistribution::getPdf(-1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testMgfOutOfBoundsException() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
ChiSquaredDistribution::getMgf(1, 0.6);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,11 +71,10 @@ class ExponentialDistributionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(2, ExponentialDistribution::getSkewness());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testMgfException() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
ExponentialDistribution::getMgf(3, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,11 +76,10 @@ class LaplaceDistributionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(\exp($m * $t) / (1 - $b ** 2 * $t ** 2), LaplaceDistribution::getMgf($t, $m, $b));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testMgfException() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
LaplaceDistribution::getMgf(3, 2, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,19 +72,17 @@ class UniformDistributionDiscreteTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(-(6 * ($n ** 2 + 1)) / (5 * ($n ** 2 - 1)), UniformDistributionDiscrete::getExKurtosis($a, $b));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testCdfExceptionUpper() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
UniformDistributionDiscrete::getCdf(5, 2, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testCdfExceptionLower() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
UniformDistributionDiscrete::getCdf(1, 2, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,11 +93,10 @@ class RequestTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('get:some/test/path?test=var', $request->__toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidRouteVerb() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$request = new Request(new Argument('get:some/test/path'));
|
||||
$request->setMethod('failure');
|
||||
$request->getRouteVerb();
|
||||
|
|
|
|||
|
|
@ -119,20 +119,18 @@ class RequestTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfRangeException
|
||||
*/
|
||||
public function testInvalidHttpsPort() : void
|
||||
{
|
||||
self::expectedException(\OutOfRangeException::class);
|
||||
|
||||
$request = new Request(new Http('http://www.google.com/test/path'));
|
||||
$request->isHttps(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidRouteVerb() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$request = new Request(new Http('http://www.google.com/test/path'));
|
||||
$request->setMethod('failure');
|
||||
$request->getRouteVerb();
|
||||
|
|
|
|||
|
|
@ -50,29 +50,26 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
|
|||
$info->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPathLoad() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
$info = new InfoManager(__DIR__ . '/invalid.json');
|
||||
$info->load();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPathUpdate() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
$info = new InfoManager(__DIR__ . '/invalid.json');
|
||||
$info->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidDataSet() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$info = new InfoManager(__DIR__ . '/info-test.json');
|
||||
$info->load();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,11 +31,10 @@ class EnumArrayTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse(EnumArrayDemo::isValidValue('e3'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testInvalidConstantException() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
EnumArrayDemo::get('enum2');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@ class EnumTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('ENUM2', EnumDemo::getName(';l'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testEmailException() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
EnumDemo::getByName('ENUM3');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,27 +49,24 @@ class IbanTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(22, $iban->getLength());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidIbanCountry() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$iban = new Iban('ZZ22 6008 0000 0960 0280 00');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidIbanLength() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$iban = new Iban('DE22 6008 0000 0960 0280 0');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidIbanChecksum() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$iban = new Iban('DEA9 6008 0000 0960 0280 00');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,11 +211,10 @@ class PriorityQueueTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(1, $queue->count());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidPriority() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$queue = new PriorityQueue(99999);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,51 +100,46 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse(Directory::move($this->con, __DIR__ . '/invalid', __DIR__ . '/invalid2'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidCreatedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
Directory::created($this->con, __DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidChangedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
Directory::changed($this->con, __DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidSizePath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
Directory::size($this->con, __DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPermissionPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
Directory::permission($this->con, __DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidOwnerPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
Directory::owner($this->con, __DIR__ . '/invalid');
|
||||
|
|
|
|||
|
|
@ -94,11 +94,10 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
\unlink($testFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidGetPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
File::get($this->con, __DIR__ . '/invalid.txt');
|
||||
|
|
@ -116,51 +115,46 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse(File::move($this->con, __DIR__ . '/invalid.txt', __DIR__ . '/invalid2.txt'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidCreatedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
File::created($this->con, __DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidChangedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
File::changed($this->con, __DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidSizePath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
File::size($this->con, __DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPermissionPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
File::permission($this->con, __DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidOwnerPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
self::assertNotFalse($this->con);
|
||||
|
||||
File::owner($this->con, __DIR__ . '/invalid.txt');
|
||||
|
|
|
|||
|
|
@ -81,43 +81,38 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse(Directory::move(__DIR__ . '/invalid', __DIR__ . '/invalid2'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidCreatedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
Directory::created(__DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidChangedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
Directory::changed(__DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidSizePath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
Directory::size(__DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPermissionPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
Directory::permission(__DIR__ . '/invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidOwnerPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
Directory::owner(__DIR__ . '/invalid');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,11 +79,10 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
\unlink($testFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidGetPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
File::get(__DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
|
|
@ -97,43 +96,38 @@ class FileTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse(File::move(__DIR__ . '/invalid.txt', __DIR__ . '/invalid2.txt'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidCreatedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
File::created(__DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidChangedPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
File::changed(__DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidSizePath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
File::size(__DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPermissionPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
File::permission(__DIR__ . '/invalid.txt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidOwnerPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
File::owner(__DIR__ . '/invalid.txt');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,59 +125,52 @@ class LocalStorageTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(6, \count(LocalStorage::list($dirTestPath)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPutPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::put(__DIR__, 'Test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidGetPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::get(__DIR__);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidListPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::list(__DIR__ . '/LocalStorageTest.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidSetPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::set(__DIR__, 'Test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidAppendPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::append(__DIR__, 'Test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidPrependPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::prepend(__DIR__, 'Test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testInvalidExtensionPath() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
LocalStorage::extension(__DIR__);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ class StorageTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\System\File\Local\LocalStorage', Storage::env('test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidStorage() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
self::assertInstanceOf('\phpOMS\System\File\Local\LocalStorage', Storage::env('invalid'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,27 +30,24 @@ class C128AbstractTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('abc', $this->obj->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testInvalidDimensionWidth() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
$this->obj->setDimension(-2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testInvalidDimensionHeight() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
$this->obj->setDimension(1, -2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\Stdlib\Base\Exception\InvalidEnumValue
|
||||
*/
|
||||
public function testInvalidOrientation() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
|
||||
|
||||
$this->obj->setOrientation(99);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,11 +73,10 @@ class C25Test extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse(C25::isValidString('1234567A890'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidOrientation() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$img = new C25('45f!a?12');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,27 +27,24 @@ class CurrencyTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertGreaterThan(0, Currency::convertCurrency(1, ISO4217CharEnum::_USD, ISO4217CharEnum::_GBP));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidFromEur() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Currency::fromEurTo(1, 'ERROR');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidToEur() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Currency::fromToEur(1, 'ERROR');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidConvert() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Currency::convertCurrency(1, 'ERROR', 'TEST');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,179 +160,157 @@ class MeasurementTest extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidTemperatureFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertTemperature(1.1, 'invalid', TemperatureType::CELSIUS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidTemperatureTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertTemperature(1.1, TemperatureType::CELSIUS, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidWeightFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertWeight(1.1, 'invalid', WeightType::KILOGRAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidWeightTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertWeight(1.1, WeightType::KILOGRAM, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidLengthFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertLength(1.1, 'invalid', LengthType::METERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidLengthTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertLength(1.1, LengthType::METERS, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidAreaFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertArea(1.1, 'invalid', AreaType::SQUARE_METERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidAreaTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertArea(1.1, AreaType::SQUARE_METERS, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidVolumeFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertVolume(1.1, 'invalid', VolumeType::LITER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidVolumeTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertVolume(1.1, VolumeType::LITER, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidSpeedFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertSpeed(1.1, 'invalid', SpeedType::KILOMETERS_PER_HOUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidSpeedTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertSpeed(1.1, SpeedType::KILOMETERS_PER_HOUR, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidTimeFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertTime(1.1, 'invalid', TimeType::HOURS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidTimeTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertTime(1.1, TimeType::HOURS, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidAngleFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertAngle(1.1, 'invalid', AngleType::RADIAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidAngleTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertAngle(1.1, AngleType::RADIAN, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidPressureFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertPressure(1.1, 'invalid', PressureType::BAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidPressureTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertPressure(1.1, PressureType::BAR, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidEnergyPowerFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertEnergy(1.1, 'invalid', EnergyPowerType::JOULS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidEnergyPowerTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertEnergy(1.1, EnergyPowerType::JOULS, 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidFileSizeFrom() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertFileSize(1.1, 'invalid', FileSizeType::KILOBYTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidFileSizeTo() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Measurement::convertFileSize(1.1, FileSizeType::KILOBYTE, 'invalid');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,48 +17,43 @@ use phpOMS\Utils\Encoding\Huffman\Dictionary;
|
|||
|
||||
class DictionaryTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidGetCharacter() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$dict = new Dictionary();
|
||||
$dict->get('as');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testNotExistingGetCharacter() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$dict = new Dictionary();
|
||||
$dict->get('a');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidSetCharacter() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$dict = new Dictionary();
|
||||
$dict->set('as', 'test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidSetDuplicateCharacter() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$dict = new Dictionary();
|
||||
$dict->set('a', '1');
|
||||
$dict->set('a', '1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidFormattedValue() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
$dict = new Dictionary();
|
||||
$dict->set('a', '1a');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,11 +69,10 @@ class CommitTest extends \PHPUnit\Framework\TestCase
|
|||
], $commit->getFiles());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testDuplicateLineChange() : void
|
||||
{
|
||||
self::expectedException(\Exception::class);
|
||||
|
||||
$commit = new Commit();
|
||||
$commit->addChanges(__DIR__ . '/CommitTest.php', 1, '<?php', 'test');
|
||||
$commit->addChanges(__DIR__ . '/CommitTest.php', 1, '<?php', 'test');
|
||||
|
|
|
|||
|
|
@ -59,11 +59,10 @@ class ArrayParserTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($expected, eval('return '. ArrayParser::serializeArray($array) . ';'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \UnexpectedValueException
|
||||
*/
|
||||
public function testInvalidValueType() : void
|
||||
{
|
||||
self::expectedException(\UnexpectedValueException::class);
|
||||
|
||||
ArrayParser::parseVariable(new class {});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,19 +47,17 @@ class PermutationTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(['c', 'b', 'a'], Permutation::permutate(['a', 'b', 'c'], [2, 1, 1]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testWrongPermuteParameterType() : void
|
||||
{
|
||||
self::expectedException(\InvalidArgumentException::class);
|
||||
|
||||
Permutation::permutate(4, [2, 1, 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \OutOfBoundsException
|
||||
*/
|
||||
public function testWrongPermuteKeyLength() : void
|
||||
{
|
||||
self::expectedException(\OutOfBoundsException::class);
|
||||
|
||||
Permutation::permutate('abc', [2, 1, 1, 6]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,22 +117,20 @@ class ViewTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('<strong>Test</strong>', $view->render());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testRenderException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
$view = new View($this->app, new Request(new Http('')), new Response());
|
||||
$view->setTemplate('something.txt');
|
||||
|
||||
$view->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \phpOMS\System\File\PathException
|
||||
*/
|
||||
public function testSerializeException() : void
|
||||
{
|
||||
self::expectedException(\phpOMS\System\File\PathException::class);
|
||||
|
||||
$view = new View($this->app, new Request(new Http('')), new Response());
|
||||
$view->setTemplate('something.txt');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user