--- /dev/null
+<?php
+
+class PdoPatchManagerTest extends AlloServeurTest {
+
+ /** @var PdoPatchManager */
+ private $pdoPatchManager;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->pdoPatchManager = new PdoPatchManager();
+ }
+
+ public function testPatchExists(){
+ $patch_info = $this->pdoPatchManager->patchExists(1,2);
+ $this->assertEquals("echo toto",$patch_info['script_content']);
+ }
+
+ public function testCreate(){
+ $patch = new Patch();
+ $patch->version_id_from = 2;
+ $patch->version_id_to = 3;
+ $patch->script_content = "date";
+ $patch->script_name = "test.txt";
+ $this->pdoPatchManager->edit($patch);
+ $patch_info = $this->pdoPatchManager->patchExists(2,3);
+ $this->assertEquals("date",$patch_info['script_content']);
+ }
+
+ public function testUpdate(){
+ $patch = new Patch();
+ $patch->id = 1;
+ $patch->version_id_from = 1;
+ $patch->version_id_to = 2;
+ $patch->script_content = "date";
+ $patch->script_name = "test.sh";
+ $this->pdoPatchManager->edit($patch);
+ $patch_info = $this->pdoPatchManager->patchExists(1,2);
+ $this->assertEquals("date",$patch_info['script_content']);
+ }
+
+ public function testDelete(){
+ $this->pdoPatchManager->delete(1);
+ $this->assertFalse($this->pdoPatchManager->patchExists(1,2));
+ }
+
+ public function testGetInfo(){
+ $patch_info = $this->pdoPatchManager->getInfo(1);
+ $this->assertEquals("echo toto",$patch_info['script_content']);
+ }
+
+ public function testGetListByVersionTo(){
+ $info = $this->pdoPatchManager->getListByVersionTo(2);
+ $this->assertEquals("1",$info[0]['version_id_from']);
+ }
+
+}
\ No newline at end of file