3 namespace RedUNIT\Base;
5 use RedUNIT\Base as Base;
6 use RedBeanPHP\Facade as R;
7 use RedBeanPHP\RedException as RedException;
12 * This performance test is used with runperf and xdebug profiler.
14 * @file RedUNIT/Base/Performance.php
15 * @desc Performance testing.
16 * @author Gabor de Mooij and the RedBeanPHP Community
17 * @license New BSD/GPLv2
19 * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
20 * This source file is subject to the New BSD/GPLv2 License that is bundled
21 * with this source code in the file license.txt.
23 class Performance extends Base
30 public function setup()
35 $book = R::dispense( 'book' );
36 $book->title = 'book';
37 $pages = R::dispense( 'page', 10 );
38 foreach( $pages as $page ) {
39 $page->content = 'lorem ipsum';
40 $page->title = 'data';
41 $page->sequence = 'data';
42 $page->order = 'data';
43 $page->columns = 'data';
44 $page->paragraphs = 'data';
45 $page->paragraphs1 = 'data';
46 $page->paragraphs2 = 'data';
47 $page->paragraphs3 = 'data';
48 $page->paragraphs4 = 'data';
50 $book->xownPageList = $pages;
51 $tags = R::dispense( 'tag', 6 );
52 foreach( $tags as $tag ) {
55 $book->sharedTagList = $tags;
64 public function crud()
68 $book = R::dispense( 'book' );
69 $book->title = 'Book';
70 $page = R::dispense('page');
71 $page->content = 'Content';
72 $page->title = 'data';
73 $page->sequence = 'data';
74 $page->order = 'data';
75 $page->columns = 'data';
76 $page->paragraphs = 'data';
77 $page->paragraphs1 = 'data';
78 $page->paragraphs2 = 'data';
79 $page->paragraphs3 = 'data';
80 $page->paragraphs4 = 'data';
81 $tag = R::dispense('tag');
83 $book->noLoad()->ownPage[] = $page;
84 $book->noLoad()->sharedTag[] = $tag;
86 $book = $book->fresh();
94 * CRUD performance Array Access.
98 public function crudaa()
102 $book = R::dispense( 'book' );
103 $book['title'] = 'Book';
104 $page = R::dispense('page');
105 $page['content'] = 'Content';
106 $page['title'] = 'data';
107 $page['sequence'] = 'data';
108 $page['order'] = 'data';
109 $page['columns'] = 'data';
110 $page['paragraphs'] = 'data';
111 $page['paragraphs1'] = 'data';
112 $page['paragraphs2'] = 'data';
113 $page['paragraphs3'] = 'data';
114 $page['paragraphs4'] = 'data';
115 $tag = R::dispense('tag');
116 $tag['label'] = 'Tag ';
117 $book->ownPage[] = $page;
118 $book->noLoad()->sharedTag[] = $tag;
120 $book = $book->fresh();