mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-07 21:18:39 +00:00
fix unit tests
This commit is contained in:
parent
3b13170a01
commit
c720655d3f
|
|
@ -17,6 +17,7 @@ namespace phpOMS\DataStorage\Database\Query\Grammar;
|
||||||
use phpOMS\DataStorage\Database\GrammarAbstract;
|
use phpOMS\DataStorage\Database\GrammarAbstract;
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
use phpOMS\DataStorage\Database\Query\Column;
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\Query\From;
|
||||||
use phpOMS\DataStorage\Database\Query\Parameter;
|
use phpOMS\DataStorage\Database\Query\Parameter;
|
||||||
use phpOMS\DataStorage\Database\Query\QueryType;
|
use phpOMS\DataStorage\Database\Query\QueryType;
|
||||||
use phpOMS\DataStorage\Database\Query\Where;
|
use phpOMS\DataStorage\Database\Query\Where;
|
||||||
|
|
@ -262,7 +263,7 @@ class Grammar extends GrammarAbstract
|
||||||
|
|
||||||
if (isset($element['value'])) {
|
if (isset($element['value'])) {
|
||||||
$expression .= ' ' . \strtoupper($element['operator']) . ' ' . $this->compileValue($query, $element['value']);
|
$expression .= ' ' . \strtoupper($element['operator']) . ' ' . $this->compileValue($query, $element['value']);
|
||||||
} elseif (isset($element['value']) && !($element['column'] instanceof Where)) {
|
} elseif ($element['value'] === null && !($element['column'] instanceof Where)) {
|
||||||
$operator = $element['operator'] === '=' ? 'IS' : 'IS NOT';
|
$operator = $element['operator'] === '=' ? 'IS' : 'IS NOT';
|
||||||
$expression .= ' ' . $operator . ' ' . $this->compileValue($query, $element['value']);
|
$expression .= ' ' . $operator . ' ' . $this->compileValue($query, $element['value']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,6 +304,8 @@ $GLOBALS['dbpool']->create('schema', $CONFIG['db']['core']['masters']['schema'])
|
||||||
|
|
||||||
DataMapperAbstract::setConnection($GLOBALS['dbpool']->get());
|
DataMapperAbstract::setConnection($GLOBALS['dbpool']->get());
|
||||||
|
|
||||||
|
$GLOBALS['frameworkpath'] = '/';
|
||||||
|
|
||||||
function phpServe(): void
|
function phpServe(): void
|
||||||
{
|
{
|
||||||
// OS detection
|
// OS detection
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testPostData() : void
|
public function testPostData() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestPost.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestPost.php'));
|
||||||
$request->setMethod(RequestMethod::POST);
|
$request->setMethod(RequestMethod::POST);
|
||||||
$request->getHeader()->set('Content-Type', MimeType::M_POST);
|
$request->getHeader()->set('Content-Type', MimeType::M_POST);
|
||||||
$request->setData('testKey', 'testValue');
|
$request->setData('testKey', 'testValue');
|
||||||
|
|
@ -404,7 +404,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testJsonData() : void
|
public function testJsonData() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestPost.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestPost.php'));
|
||||||
$request->setMethod(RequestMethod::POST);
|
$request->setMethod(RequestMethod::POST);
|
||||||
$request->getHeader()->set('Content-Type', MimeType::M_JSON);
|
$request->getHeader()->set('Content-Type', MimeType::M_JSON);
|
||||||
$request->setData('testKey', 'testValue');
|
$request->setData('testKey', 'testValue');
|
||||||
|
|
@ -422,7 +422,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testMultipartData() : void
|
public function testMultipartData() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestPost.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestPost.php'));
|
||||||
$request->setMethod(RequestMethod::POST);
|
$request->setMethod(RequestMethod::POST);
|
||||||
$request->getHeader()->set('Content-Type', MimeType::M_MULT);
|
$request->getHeader()->set('Content-Type', MimeType::M_MULT);
|
||||||
$request->setData('testKey', 'testValue');
|
$request->setData('testKey', 'testValue');
|
||||||
|
|
@ -440,7 +440,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testLanguage() : void
|
public function testLanguage() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestLanguage.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestLanguage.php'));
|
||||||
$request->setMethod(RequestMethod::GET);
|
$request->setMethod(RequestMethod::GET);
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
@ -456,7 +456,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testLocale() : void
|
public function testLocale() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestLocale.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestLocale.php'));
|
||||||
$request->setMethod(RequestMethod::GET);
|
$request->setMethod(RequestMethod::GET);
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
@ -472,7 +472,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testMobile() : void
|
public function testMobile() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestMobile.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestMobile.php'));
|
||||||
$request->setMethod(RequestMethod::GET);
|
$request->setMethod(RequestMethod::GET);
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
@ -488,7 +488,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testOS() : void
|
public function testOS() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestOS.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestOS.php'));
|
||||||
$request->setMethod(RequestMethod::GET);
|
$request->setMethod(RequestMethod::GET);
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
@ -504,7 +504,7 @@ class HttpRequestTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testBrowser() : void
|
public function testBrowser() : void
|
||||||
{
|
{
|
||||||
$request = new HttpRequest(new HttpUri('http://localhost:1234/phpOMS/tests/Message/Http/HttpRequestBrowser.php'));
|
$request = new HttpRequest(new HttpUri('http://localhost:1234' . $GLOBALS['frameworkpath'] . 'tests/Message/Http/HttpRequestBrowser.php'));
|
||||||
$request->setMethod(RequestMethod::GET);
|
$request->setMethod(RequestMethod::GET);
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class MarkdownTest extends \PHPUnit\Framework\TestCase
|
||||||
if ($data[1] === 'md'
|
if ($data[1] === 'md'
|
||||||
&& (\file_get_contents(__DIR__ . '/data/' . $data[0] . '.html') !== Markdown::parse(\file_get_contents(__DIR__ . '/data/' . $data[0] . '.md')))
|
&& (\file_get_contents(__DIR__ . '/data/' . $data[0] . '.html') !== Markdown::parse(\file_get_contents(__DIR__ . '/data/' . $data[0] . '.md')))
|
||||||
) {
|
) {
|
||||||
self::asserTrue(false, $file);
|
self::assertTrue(false, $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
<p><a href="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">xss</a></p>
|
<p><a href="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">xss</a></p>
|
||||||
<p><a href="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">xss</a></p>
|
<p><a href="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">xss</a></p>
|
||||||
<p><a href="data%3A//text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">xss</a></p>
|
<p><a href="data%3A//text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">xss</a></p>
|
||||||
<p><a href="data?colon;text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg=">xss</a></p>
|
|
||||||
<p><img src="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==" alt="xss" /></p>
|
<p><img src="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==" alt="xss" /></p>
|
||||||
<p><img src="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==" alt="xss" /></p>
|
<p><img src="data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==" alt="xss" /></p>
|
||||||
<p><img src="data%3A//text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==" alt="xss" /></p>
|
<p><img src="data%3A//text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==" alt="xss" /></p>
|
||||||
<p><img src="data?colon;text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg=" alt="xss" /></p>
|
|
||||||
|
|
@ -20,12 +20,8 @@
|
||||||
|
|
||||||
[xss](data://text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)
|
[xss](data://text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)
|
||||||
|
|
||||||
[xss](data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
|
||||||
|
|
@ -37,6 +37,6 @@
|
||||||
<php>
|
<php>
|
||||||
<const name="WEB_SERVER_HOST" value="localhost" />
|
<const name="WEB_SERVER_HOST" value="localhost" />
|
||||||
<const name="WEB_SERVER_PORT" value="1234" />
|
<const name="WEB_SERVER_PORT" value="1234" />
|
||||||
<const name="WEB_SERVER_DOCROOT" value="./../" />
|
<const name="WEB_SERVER_DOCROOT" value="./" />
|
||||||
</php>
|
</php>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user