Yaffs site version 1.1
[yaffs-website] / vendor / gabordemooij / redbean / testing / RedUNIT / Base / Issue90.php
1 <?php
2
3 namespace RedUNIT\Base;
4
5 use RedUNIT\Base as Base;
6 use RedBeanPHP\Facade as R;
7
8 /**
9  * Issue90
10  *
11  * Tests whether this specific issue on github has been resolved.
12  * Checking 'own' relationship, makes it impossible to trash a bean.
13  *
14  * @file    RedUNIT/Base/Issue90.php
15  * @desc    Issue #90 - cannot trash bean with ownproperty if checked in model.
16  * @author  Gabor de Mooij and the RedBeanPHP Community
17  * @license New BSD/GPLv2
18  *
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.
22  */
23 class Issue90 extends Base
24 {
25         /**
26          * Test for issue90.
27          * Checking 'own' relationship, makes it impossible to trash a bean.
28          *
29          * @return void
30          */
31         public function testIssue90()
32         {
33                 $s = R::dispense( 'box' );
34                 $s->name = 'a';
35                 $f = R::dispense( 'bottle' );
36                 $s->ownBottle[] = $f;
37                 R::store( $s );
38                 $s2 = R::dispense( 'box' );
39                 $s2->name = 'a';
40                 R::store( $s2 );
41                 R::trash( $s2 );
42                 pass();
43         }
44 }