RedUNIT\Base\Misc::testENUMInQuery PHP Method

testENUMInQuery() public method

Test ENUM in Queries and with short hand notation.
public testENUMInQuery ( ) : void
return void
    public function testENUMInQuery()
    {
        testpack('Test ENUM in Query and test ENUM short notation');
        R::nuke();
        $coffee = R::dispense('coffee');
        $coffee->taste = R::enum('flavour:mocca');
        R::store($coffee);
        $coffee = R::dispense('coffee');
        $coffee->taste = R::enum('flavour:banana');
        R::store($coffee);
        $coffee = R::dispense('coffee');
        $coffee->taste = R::enum('flavour:banana');
        R::store($coffee);
        //now we have two flavours
        asrt(R::count('flavour'), 2);
        //use in query
        asrt(R::count('coffee', ' taste_id = ? ', array(R::enum('flavour:mocca')->id)), 1);
        //use in quer with short notation
        asrt(R::count('coffee', ' taste_id = ? ', array(EID('flavour:mocca'))), 1);
        //use in query
        asrt(R::count('coffee', ' taste_id = ? ', array(R::enum('flavour:banana')->id)), 2);
        //use in quer with short notation
        asrt(R::count('coffee', ' taste_id = ? ', array(EID('flavour:banana'))), 2);
        //use in query
        asrt(R::count('coffee', ' taste_id = ? ', array(R::enum('flavour:strawberry')->id)), 0);
        //use in quer with short notation
        asrt(R::count('coffee', ' taste_id = ? ', array(EID('flavour:strawberry'))), 0);
    }