| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Aimeos\MShop\Common\Manager\Group; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @copyright Aimeos (aimeos.org), 2015 | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  | class Typo3Test extends \PHPUnit_Framework_TestCase | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | 	private $object = null; | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  | 	private $editor = ''; | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | 	protected function setUp() | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  | 		$context = \TestHelper::getContext(); | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  | 		$this->editor = $context->getEditor(); | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  | 		$this->object = new \Aimeos\MShop\Customer\Manager\Group\Typo3( $context ); | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	protected function tearDown() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 		unset( $this->object ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 28 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	public function testCleanup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 		$this->object->cleanup( array( -1 ) ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 34 |  |  | 	} | 
            
                                                                        
                                                                
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	public function testSaveItem() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		$item = new \Aimeos\MShop\Customer\Item\Group\Standard(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		$this->setExpectedException( '\\Aimeos\\MShop\\Customer\\Exception' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		$this->object->saveItem( $item ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	public function testDeleteItem() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		$this->setExpectedException( '\\Aimeos\\MShop\\Customer\\Exception' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		$this->object->deleteItem( -1 ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 50 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	public function testSearchItem() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$search = $this->object->createSearch(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		$search->setConditions( $search->compare( '==', 'customer.group.label', 'Unit test group' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		$search->setSlice( 0, 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 		$total = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		$results = $this->object->searchItems( $search, array(), $total ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		$this->assertEquals( 1, count( $results ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 		$this->assertEquals( 1, $total ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 64 |  |  | 	} | 
            
                                                        
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 66 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 67 |  |  |  |