RedUNIT\Base\Xnull::testBasicNullHandling PHP Метод

testBasicNullHandling() публичный Метод

Test NULL handling, setting a property to NULL must cause a change.
public testBasicNullHandling ( ) : void
Результат void
    public function testBasicNullHandling()
    {
        // NULL can change bean
        $bean = R::dispense('bean');
        $bean->bla = 'a';
        R::store($bean);
        $bean = $bean->fresh();
        asrt($bean->hasChanged('bla'), FALSE);
        $bean->bla = NULL;
        asrt($bean->hasChanged('bla'), TRUE);
        // NULL test
        $page = R::dispense('page');
        $book = R::dispense('book');
        $page->title = 'a NULL page';
        $page->book = $book;
        $book->title = 'Why NUll is painful..';
        R::store($page);
        $bookid = $page->book->id;
        unset($page->book);
        $id = R::store($page);
        $page = R::load('page', $id);
        $page->title = 'another title';
        R::store($page);
        pass();
        $page = R::load('page', $id);
        $page->title = 'another title';
        $page->book_id = NULL;
        R::store($page);
        pass();
    }