mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-14 00:44:23 -05:00
Begin Refactor
This commit is contained in:
47
vendor/gabordemooij/redbean/testing/RedUNIT/Blackhole/Labels.php
vendored
Normal file
47
vendor/gabordemooij/redbean/testing/RedUNIT/Blackhole/Labels.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace RedUNIT\Blackhole;
|
||||
|
||||
use RedUNIT\Blackhole as Blackhole;
|
||||
use RedBeanPHP\Facade as R;
|
||||
use RedBeanPHP\OODBBean as OODBBean;
|
||||
|
||||
/**
|
||||
* Labels
|
||||
*
|
||||
* Labels are very simple beans, only having a title and an ID.
|
||||
* The idea behind labels is that they are very easy to generate
|
||||
* from a comma separated list and they can easily be converted
|
||||
* to such a list. Labels can be used for simplistic relations in the
|
||||
* database like tagging or enums.
|
||||
*
|
||||
* @file RedUNIT/Blackhole/Labels.php
|
||||
* @desc Tests Facade Label functions.
|
||||
* @author Gabor de Mooij and the RedBeanPHP Community
|
||||
* @license New BSD/GPLv2
|
||||
*
|
||||
* (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
|
||||
* This source file is subject to the New BSD/GPLv2 License that is bundled
|
||||
* with this source code in the file license.txt.
|
||||
*/
|
||||
|
||||
class Labels extends Blackhole
|
||||
{
|
||||
/**
|
||||
* Test basic labels.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testLabels()
|
||||
{
|
||||
testpack( 'Test Labels' );
|
||||
$meals = R::dispenseLabels( 'meal', array( 'meat', 'fish', 'vegetarian' ) );
|
||||
asrt( is_array( $meals ), TRUE );
|
||||
asrt( count( $meals ), 3 );
|
||||
foreach ( $meals as $m ) {
|
||||
asrt( ( $m instanceof OODBBean ), TRUE );
|
||||
}
|
||||
$listOfMeals = implode( ',', R::gatherLabels( $meals ) );
|
||||
asrt( $listOfMeals, 'fish,meat,vegetarian' );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user