55use App \Entity \Validation ;
66use App \Service \ValidatorArgumentsService ;
77use App \Storage \ValidationsStorage ;
8+ use App \Validation \ValidationFactory ;
89use Doctrine \Bundle \FixturesBundle \Fixture ;
910use Doctrine \Persistence \ObjectManager ;
1011use RuntimeException ;
@@ -73,7 +74,8 @@ private function addSampleArchive(Validation $validation, $filename)
7374 throw new RuntimeException ('Sample file not found : ' . $ originalPath );
7475 }
7576
76- $ validationDirectory = $ this ->validationsStorage ->getDirectory ($ validation );
77+ $ this ->validationsStorage ->init ($ validation );
78+ $ validationDirectory = $ this ->validationsStorage ->getPath ();
7779 $ fs = new Filesystem ();
7880 $ validation ->setDatasetName (str_replace ('.zip ' , '' , $ filename ));
7981 $ fs ->copy (
@@ -90,15 +92,17 @@ public function load(ObjectManager $em): void
9092 * validation_no_args - a validation with no args
9193 */
9294 $ validationNoArgs = new Validation ();
95+ $ validationNoArgs ->setUid (ValidationFactory::generateUid ());
9396 $ this ->addSampleArchive ($ validationNoArgs , self ::FILENAME_SUP_PM3 );
9497 $ em ->persist ($ validationNoArgs );
95- $ this ->addReference (self ::VALIDATION_NO_ARGS , $ validationNoArgs );
98+ $ this ->addReference ( self ::VALIDATION_NO_ARGS , $ validationNoArgs );
9699
97100 /*
98101 * validation_archived - a validation that has already been archived
99102 * (no file, archived)
100103 */
101104 $ valArchived = new Validation ();
105+ $ valArchived ->setUid (ValidationFactory::generateUid ());
102106 $ valArchived ->setDatasetName ('130010853_PM3_60_20180516 ' );
103107 $ valArchived ->setStatus (Validation::STATUS_ARCHIVED );
104108 $ em ->persist ($ valArchived );
@@ -110,12 +114,14 @@ public function load(ObjectManager $em): void
110114 $ args = [
111115 'srs ' => 'EPSG:2154 ' ,
112116 'model ' => 'https://ignf.github.io/validator/validator-plugin-cnig/src/test/resources/config/cnig_SUP_PM3_2016.json ' ,
117+ 'keepData ' => false
113118 ];
114119 $ args = $ this ->valArgsService ->validate (\json_encode ($ args ));
115120
116121 $ valWithArgs = new Validation ();
122+ $ valWithArgs ->setUid (ValidationFactory::generateUid ());
117123 $ this ->addSampleArchive ($ valWithArgs , self ::FILENAME_SUP_PM3 );
118- $ valWithArgs ->setStatus (Validation::STATUS_PENDING );
124+ $ valWithArgs ->setStatus (Validation::STATUS_WAITING_ARGS );
119125 $ valWithArgs ->setArguments ($ args );
120126 $ em ->persist ($ valWithArgs );
121127 $ this ->addReference (self ::VALIDATION_WITH_ARGS , $ valWithArgs );
@@ -127,12 +133,15 @@ public function load(ObjectManager $em): void
127133 $ args = [
128134 'srs ' => 'EPSG:2154 ' ,
129135 'model ' => 'https://www.geoportail-urbanisme.gouv.fr/standard/cnig_SUP_PM3_2016-test.json ' ,
136+ 'keepData ' => false
130137 ];
131138 $ args = $ this ->valArgsService ->validate (\json_encode ($ args ));
132139
133140 $ valWithBadArgs = new Validation ();
141+ $ valWithBadArgs ->setUid (ValidationFactory::generateUid ());
142+
134143 $ this ->addSampleArchive ($ valWithBadArgs , self ::FILENAME_SUP_PM3 );
135- $ valWithBadArgs ->setStatus (Validation::STATUS_PENDING );
144+ $ valWithBadArgs ->setStatus (Validation::STATUS_WAITING_ARGS );
136145 $ valWithBadArgs ->setArguments ($ args );
137146 $ em ->persist ($ valWithBadArgs );
138147 $ this ->addReference (self ::VALIDATION_WITH_BAD_ARGS , $ valWithBadArgs );
@@ -143,12 +152,15 @@ public function load(ObjectManager $em): void
143152 $ args = [
144153 'srs ' => 'EPSG:2154 ' ,
145154 'model ' => 'https://ignf.github.io/validator/validator-plugin-cnig/src/test/resources/config/cnig_SUP_PM3_2016.json ' ,
155+ 'keepData ' => false
146156 ];
147157 $ args = $ this ->valArgsService ->validate (\json_encode ($ args ));
148158
149159 $ valInvalidRegex = new Validation ();
160+ $ valInvalidRegex ->setUid (ValidationFactory::generateUid ());
161+
150162 $ this ->addSampleArchive ($ valInvalidRegex , self ::FILENAME_INVALID_REGEX );
151- $ valInvalidRegex ->setStatus (Validation::STATUS_PENDING );
163+ $ valInvalidRegex ->setStatus (Validation::STATUS_WAITING_ARGS );
152164 $ valInvalidRegex ->setArguments ($ args );
153165 $ em ->persist ($ valInvalidRegex );
154166 $ this ->addReference (self ::VALIDATION_INVALID_REGEX , $ valInvalidRegex );
0 commit comments