| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @copyright Aimeos (aimeos.org), 2017-2025 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | namespace Aimeos\Admin\JsonAdm\Service\Config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | class StandardTest extends \PHPUnit\Framework\TestCase | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  | 	private $context; | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  | 	private $object; | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | 	private $view; | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  | 	protected function setUp() : void | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  | 		$this->context = \TestHelper::context(); | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  | 		$this->view = $this->context->view(); | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  | 		$this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard( $this->context, 'service/config' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  | 		$this->object->setAimeos( \TestHelper::getAimeos() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  | 		$this->object->setView( $this->view ); | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	public function testGet() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 		$params = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 			'id' => 'DirectDebit,Category', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 			'type' => 'payment', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 		$helper = new \Aimeos\Base\View\Helper\Param\Standard( $this->view, $params ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 		$this->view->addHelper( 'param', $helper ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		$response = $this->object->get( $this->view->request(), $this->view->response() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 		$result = json_decode( (string) $response->getBody(), true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		$this->assertEquals( 200, $response->getStatusCode() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 		$this->assertEquals( 2, $result['meta']['total'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 		$this->assertIsArray( $result['data'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		$this->assertEquals( 'category.include', $result['data'][0]['id'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		$this->assertEquals( 'category.exclude', $result['data'][1]['id'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 50 |  |  | 		$this->assertArrayNotHasKey( 'errors', $result ); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 51 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 52 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |  |