mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 16:57:33 -04:00 
			
		
		
		
	Roll back tests for fatturaPA
This commit is contained in:
		
							parent
							
								
									7d74bd3e29
								
							
						
					
					
						commit
						e2361afff9
					
				| @ -315,178 +315,178 @@ class FatturaPATest extends TestCase | |||||||
| 
 | 
 | ||||||
|          |          | ||||||
|     // }
 |     // }
 | ||||||
|     public function testBulkValidationX() | //     public function testBulkValidationX()
 | ||||||
|     { | //     {
 | ||||||
|      |      | ||||||
| $files = [ | // $files = [
 | ||||||
|     'tests/Integration/Einvoice/samples/fatturapa0.xml', | //     'tests/Integration/Einvoice/samples/fatturapa0.xml',
 | ||||||
| ]; | // ];
 | ||||||
| 
 | 
 | ||||||
| foreach($files as $f) { | // foreach($files as $f) {
 | ||||||
| 
 | 
 | ||||||
|     $xmlstring = file_get_contents($f); | //     $xmlstring = file_get_contents($f);
 | ||||||
| 
 | 
 | ||||||
|     $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA); | //     $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
 | ||||||
|     $json = json_encode($xml); | //     $json = json_encode($xml);
 | ||||||
|     $payload = json_decode($json, true); | //     $payload = json_decode($json, true);
 | ||||||
| 
 | 
 | ||||||
|     nlog($payload); |  | ||||||
| 
 |  | ||||||
|     $validation_array = false; |  | ||||||
|      |  | ||||||
|         nlog($f); |  | ||||||
| 
 |  | ||||||
|         $rules = FatturaElettronica::getValidationRules($this->payload); |  | ||||||
|         nlog($rules); |  | ||||||
| 
 |  | ||||||
|         $this->assertIsArray($rules); |  | ||||||
| 
 |  | ||||||
|         $payload = FatturaElettronica::from($payload)->toArray(); |  | ||||||
| //     nlog($payload);
 | //     nlog($payload);
 | ||||||
| 
 | 
 | ||||||
|         $this->assertIsArray($payload); | //     $validation_array = false;
 | ||||||
|      |      | ||||||
|         $validation_array = FatturaElettronica::validate($payload); | //         nlog($f);
 | ||||||
| 
 | 
 | ||||||
|         $this->assertIsArray($validation_array); | //         $rules = FatturaElettronica::getValidationRules($this->payload);
 | ||||||
|  | //         nlog($rules);
 | ||||||
|  | 
 | ||||||
|  | //         $this->assertIsArray($rules);
 | ||||||
|  | 
 | ||||||
|  | //         $payload = FatturaElettronica::from($payload)->toArray();
 | ||||||
|  | //         // nlog($payload);
 | ||||||
|  | 
 | ||||||
|  | //         $this->assertIsArray($payload);
 | ||||||
|  | 
 | ||||||
|  | //         $validation_array = FatturaElettronica::validate($payload);
 | ||||||
|  | 
 | ||||||
|  | //         $this->assertIsArray($validation_array);
 | ||||||
|  | 
 | ||||||
|  | //     // } catch(\Illuminate\Validation\ValidationException $e) {
 | ||||||
|  | 
 | ||||||
|  | //     //     nlog($e->errors());
 | ||||||
|  | //     // }
 | ||||||
|  | 
 | ||||||
|  | //     $this->assertIsArray($validation_array);
 | ||||||
|  | 
 | ||||||
|  | // }
 | ||||||
|  | 
 | ||||||
|  | //     }
 | ||||||
|  | 
 | ||||||
|  | //     public function testBulkValidation()
 | ||||||
|  | //     {
 | ||||||
|  | 
 | ||||||
|  | //         $files = [
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa0.xml',
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa1.xml',
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa2.xml',
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa3.xml',
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa4.xml',
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa5.xml',
 | ||||||
|  | //             'tests/Integration/Einvoice/samples/fatturapa6.xml',
 | ||||||
|  | //         ];
 | ||||||
|  | 
 | ||||||
|  | //         foreach($files as $f)
 | ||||||
|  | //         {
 | ||||||
|  | 
 | ||||||
|  | //             $xmlstring = file_get_contents($f);
 | ||||||
|  | 
 | ||||||
|  | //             $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
 | ||||||
|  | //             $json = json_encode($xml);
 | ||||||
|  | //             $payload = json_decode($json, true);
 | ||||||
|  | 
 | ||||||
|  | //             nlog($payload);
 | ||||||
|  | 
 | ||||||
|  | //             $validation_array = false;
 | ||||||
|  | //             try {
 | ||||||
|  | //                 nlog($f);
 | ||||||
|  | 
 | ||||||
|  | //                 $rules = FatturaElettronica::getValidationRules($this->payload);
 | ||||||
|  | //                 nlog($rules);
 | ||||||
|  |                  | ||||||
|  | //                 $this->assertIsArray($rules);
 | ||||||
|  | 
 | ||||||
|  | //                 $payload = FatturaElettronica::from($payload)->toArray();
 | ||||||
|  | //                 nlog($payload);
 | ||||||
|  | 
 | ||||||
|  | //                 $this->assertIsArray($payload);
 | ||||||
|  | 
 | ||||||
|  | //                 $validation_array = FatturaElettronica::validate($payload);
 | ||||||
|  |                  | ||||||
|  | //                 $this->assertIsArray($validation_array);
 | ||||||
| 
 | 
 | ||||||
| //             } catch(\Illuminate\Validation\ValidationException $e) {
 | //             } catch(\Illuminate\Validation\ValidationException $e) {
 | ||||||
| 
 | 
 | ||||||
| //                 nlog($e->errors());
 | //                 nlog($e->errors());
 | ||||||
| //             }
 | //             }
 | ||||||
| 
 | 
 | ||||||
|     $this->assertIsArray($validation_array); | //             $this->assertIsArray($validation_array);
 | ||||||
| 
 | 
 | ||||||
| } | //         }
 | ||||||
|  | //     }
 | ||||||
| 
 | 
 | ||||||
|     } | //     public function testUpdateProps()
 | ||||||
|  | //     {
 | ||||||
|  | //         $update = [
 | ||||||
|  | //             'e_invoice' => $this->payload
 | ||||||
|  | //         ];
 | ||||||
| 
 | 
 | ||||||
|     public function testBulkValidation() | //         $response = $this->withHeaders([
 | ||||||
|     { | //             'X-API-SECRET' => config('ninja.api_secret'),
 | ||||||
|  | //             'X-API-TOKEN' => $this->token,
 | ||||||
|  | //         ])->putJson('/api/v1/companies/'.$this->company->hashed_id, $update);
 | ||||||
| 
 | 
 | ||||||
|         $files = [ | //         $response->assertStatus(200);
 | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa0.xml', |  | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa1.xml', |  | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa2.xml', |  | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa3.xml', |  | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa4.xml', |  | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa5.xml', |  | ||||||
|             'tests/Integration/Einvoice/samples/fatturapa6.xml', |  | ||||||
|         ]; |  | ||||||
| 
 | 
 | ||||||
|         foreach($files as $f) | //         $arr = $response->json();
 | ||||||
|         { |  | ||||||
| 
 | 
 | ||||||
|             $xmlstring = file_get_contents($f); | //         $this->assertNotNull($arr['data']['e_invoice']);
 | ||||||
| 
 | //     }
 | ||||||
|             $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA); |  | ||||||
|             $json = json_encode($xml); |  | ||||||
|             $payload = json_decode($json, true); |  | ||||||
| 
 |  | ||||||
|             nlog($payload); |  | ||||||
| 
 |  | ||||||
|             $validation_array = false; |  | ||||||
|             try { |  | ||||||
|                 nlog($f); |  | ||||||
| 
 |  | ||||||
|                 $rules = FatturaElettronica::getValidationRules($this->payload); |  | ||||||
|                 nlog($rules); |  | ||||||
|                  |  | ||||||
|                 $this->assertIsArray($rules); |  | ||||||
| 
 |  | ||||||
|                 $payload = FatturaElettronica::from($payload)->toArray(); |  | ||||||
|                 nlog($payload); |  | ||||||
| 
 |  | ||||||
|                 $this->assertIsArray($payload); |  | ||||||
| 
 |  | ||||||
|                 $validation_array = FatturaElettronica::validate($payload); |  | ||||||
|                  |  | ||||||
|                 $this->assertIsArray($validation_array); |  | ||||||
| 
 |  | ||||||
|             } catch(\Illuminate\Validation\ValidationException $e) { |  | ||||||
| 
 |  | ||||||
|                 nlog($e->errors()); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             $this->assertIsArray($validation_array); |  | ||||||
| 
 |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public function testUpdateProps() |  | ||||||
|     { |  | ||||||
|         $update = [ |  | ||||||
|             'e_invoice' => $this->payload |  | ||||||
|         ]; |  | ||||||
| 
 |  | ||||||
|         $response = $this->withHeaders([ |  | ||||||
|             'X-API-SECRET' => config('ninja.api_secret'), |  | ||||||
|             'X-API-TOKEN' => $this->token, |  | ||||||
|         ])->putJson('/api/v1/companies/'.$this->company->hashed_id, $update); |  | ||||||
| 
 |  | ||||||
|         $response->assertStatus(200); |  | ||||||
| 
 |  | ||||||
|         $arr = $response->json(); |  | ||||||
| 
 |  | ||||||
|         $this->assertNotNull($arr['data']['e_invoice']); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     public function testUpdateBadProps() | //     public function testUpdateBadProps()
 | ||||||
|     { | //     {
 | ||||||
|         $update = [ | //         $update = [
 | ||||||
|             'e_invoice' => $this->bad_payload | //             'e_invoice' => $this->bad_payload
 | ||||||
|         ]; | //         ];
 | ||||||
| 
 | 
 | ||||||
|         $response = $this->withHeaders([ | //         $response = $this->withHeaders([
 | ||||||
|             'X-API-SECRET' => config('ninja.api_secret'), | //             'X-API-SECRET' => config('ninja.api_secret'),
 | ||||||
|             'X-API-TOKEN' => $this->token, | //             'X-API-TOKEN' => $this->token,
 | ||||||
|         ])->putJson('/api/v1/companies/'.$this->company->hashed_id, $update); | //         ])->putJson('/api/v1/companies/'.$this->company->hashed_id, $update);
 | ||||||
| 
 | 
 | ||||||
|         $response->assertStatus(200); | //         $response->assertStatus(200);
 | ||||||
| 
 | 
 | ||||||
|         $arr = $response->json(); | //         $arr = $response->json();
 | ||||||
| 
 | 
 | ||||||
|         $this->assertNotNull($arr['data']['e_invoice']); | //         $this->assertNotNull($arr['data']['e_invoice']);
 | ||||||
|     } | //     }
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     public function testLaravelDataValidation() | //     public function testLaravelDataValidation()
 | ||||||
|     { | //     {
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         $rules = FatturaElettronica::getValidationRules($this->payload); | //         $rules = FatturaElettronica::getValidationRules($this->payload);
 | ||||||
|         // nlog($rules);
 | //         // nlog($rules);
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         $this->assertIsArray($rules); | //         $this->assertIsArray($rules);
 | ||||||
| 
 | 
 | ||||||
|         // $validation_array = false;
 | //         // $validation_array = false;
 | ||||||
| 
 |  | ||||||
|         try { |  | ||||||
|             $validation_array = FatturaElettronica::validate($this->payload); |  | ||||||
|         } |  | ||||||
|         catch(\Illuminate\Validation\ValidationException $e) { |  | ||||||
| 
 |  | ||||||
|             nlog($e->errors()); |  | ||||||
| 
 |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         $this->assertIsArray($validation_array); |  | ||||||
| 
 | 
 | ||||||
| //         try {
 | //         try {
 | ||||||
|         $array = FatturaElettronica::from($this->payload)->toArray(); | //             $validation_array = FatturaElettronica::validate($this->payload);
 | ||||||
| //         }
 | //         }
 | ||||||
|         // catch(\Exception $e){
 | //         catch(\Illuminate\Validation\ValidationException $e) {
 | ||||||
| 
 | 
 | ||||||
|         // echo $e->errors();
 | //             nlog($e->errors());
 | ||||||
|             // $errors = $e->getErrors();
 |  | ||||||
| 
 | 
 | ||||||
|         // echo $e->getMessage().PHP_EOL;
 |  | ||||||
| //         }
 | //         }
 | ||||||
| 
 | 
 | ||||||
|         // $this->assertIsArray($array);
 | //         $this->assertIsArray($validation_array);
 | ||||||
|     } | 
 | ||||||
|  | //         // try{
 | ||||||
|  | //         $array = FatturaElettronica::from($this->payload)->toArray();
 | ||||||
|  | //         // }
 | ||||||
|  | //         // catch(\Exception $e){
 | ||||||
|  | 
 | ||||||
|  | //         // echo $e->errors();
 | ||||||
|  | //             // $errors = $e->getErrors();
 | ||||||
|  | 
 | ||||||
|  | //         // echo $e->getMessage().PHP_EOL;
 | ||||||
|  | //         // }
 | ||||||
|  | 
 | ||||||
|  | //         // $this->assertIsArray($array);
 | ||||||
|  | //     }
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user