-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fae8fe6
commit 60d8157
Showing
4 changed files
with
178 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Test Database | ||
* | ||
* Test Database Classes | ||
* | ||
* PHP version 8.1.2 | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
namespace Tests\Library\Database; | ||
|
||
/** | ||
* Dependances | ||
*/ | ||
use CrazyPHP\Library\Database\Driver\Mangodb; | ||
use CrazyPHP\Library\Database\Driver\Mariadb; | ||
use PHPUnit\Framework\TestCase; | ||
use CrazyPHP\Model\Env; | ||
|
||
/** | ||
* Mariadb Test | ||
* | ||
* Methods for test Mongodb | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
class MariadbTest extends TestCase { | ||
|
||
/** Public constants | ||
****************************************************** | ||
*/ | ||
|
||
|
||
/** Public method | Preparation | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Set Up Before Class | ||
* | ||
* This method is called before the first test of this test class is run. | ||
* | ||
* @return void | ||
*/ | ||
public static function setUpBeforeClass():void { | ||
|
||
# Setup env | ||
Env::set([ | ||
# App root for composer class | ||
"crazyphp_root" => getcwd(), | ||
"phpunit_test" => true, | ||
"config_location" => "@crazyphp_root/resources/Yml" | ||
]); | ||
|
||
} | ||
|
||
|
||
/** | ||
* Tear Down After Class | ||
* | ||
* This method is called after the last test of this test class is run. | ||
* | ||
* @return void | ||
*/ | ||
public static function tearDownAfterClass():void { | ||
|
||
# Reset env variables | ||
Env::reset(); | ||
|
||
} | ||
|
||
/** Public method | Tests | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Test Set Entity As Prefix | ||
* | ||
* Test envAndConfigValues function | ||
* | ||
* @return void | ||
*/ | ||
public function testSetEntityAsPrefix():void { | ||
|
||
# Set entity | ||
$entity = "Router"; | ||
|
||
# Set alias | ||
$alias = "a"; | ||
|
||
# Get result | ||
$result = Mariadb::setEntityAsPrefix($entity, $alias); | ||
|
||
# Check result | ||
$this->assertEquals("a.name AS Router_name, a.path AS Router_path", $result); | ||
|
||
} | ||
|
||
} |