Beispiel #1
0
 public function testBuildOk()
 {
     $project = new Xinc_Project();
     $project->setName('test');
     $engine = new Xinc_Engine_Sunrise();
     $build = new Xinc_Build($engine, $project);
     $this->assertEquals($engine, $build->getEngine(), 'Engine should be the same');
     $actual = $build->getNextBuildTime();
     $now = time();
     $this->assertEquals($now, $actual, 'Next Buildtimestamps should be equal to the current time');
     $buildTimestamp = $now;
     $build->setBuildTime($buildTimestamp);
     $build->setStatus(Xinc_Build_Interface::PASSED);
     $build->getProperties()->set('test', 1);
     //$workingDir = getcwd();
     //Xinc::getInstance()->setStatusDir($workingDir);
     try {
         $result = $build->serialize();
         $this->assertTrue($result, 'Should serialize successfull');
     } catch (Exception $e) {
         $this->assertTrue(false, 'Serialization should not throw an execption');
     }
     // test lastBuild
     $lastBuild = $build->getLastBuild();
     $this->assertEquals($lastBuild->getProperties()->get('test'), 1, 'Last build should have same property value');
     try {
         $object = Xinc_Build::unserialize($project, $buildTimestamp);
     } catch (Exception $e) {
         $this->assertTrue(false, 'Unserialization should not throw an execption');
     }
     $this->assertEquals($build->getProject()->getName(), $object->getProject()->getName(), 'Project Name should have gotten serialized');
     $this->assertEquals($build->getProperties()->get('test'), $object->getProperties()->get('test'), 'Properties should be equal');
     $this->assertEquals($build->getStatus(), $object->getStatus(), 'statuses should be equal');
 }