Skip to content

Commit

Permalink
Fix Datetime cast invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Malot committed Jul 20, 2016
1 parent 117c891 commit de4d2b8
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Cerbere/Model/ReleaseHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function compare(Project $project)
if (!$project->getDatestamp()) {
// We don't have current timestamp info, so we can't know.
continue;
} elseif ($release->getDate() && ($project->getDatestamp() + 100 > $release->getDate())) {
} elseif ($release->getDate() && ($project->getDatestamp() + 100 > $release->getDate()->getTimestamp())) {
// We're newer than this, so we can skip it.
continue;
}
Expand Down
72 changes: 69 additions & 3 deletions lib/Cerbere/Tests/Units/Model/ReleaseHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public function testCodeCoverage()

$this->integer($project->getStatus())->isEqualTo(\Cerbere\Model\ReleaseHistory::UPDATE_NOT_SECURE);



// 5.10 should be outdated.
$project = $this->createProjectFromFile('5.10');

Expand All @@ -57,6 +55,18 @@ public function testCodeCoverage()
$release_history->compare($project);

$this->integer($project->getStatus())->isEqualTo(\Cerbere\Model\ReleaseHistory::UPDATE_NOT_CURRENT);

/********************************************************/

// Test with a DEV release.
$release_history = new \Cerbere\Model\ReleaseHistory();

$project = $this->createProjectSearchAPIFromFile();

$release_history->prepare($project);
$release_history->compare($project);

$this->integer($project->getStatus())->isEqualTo(\Cerbere\Model\ReleaseHistory::UPDATE_NOT_SECURE);
}

/**
Expand All @@ -81,7 +91,7 @@ protected function createProjectFromFile($version)
test_dependencies[] = views
; Information added by Drupal.org packaging script on 2015-10-05
version = "7.x-' . $version . '"
version = "7.x-'.$version.'"
core = "7.x"
project = "twitter"
datestamp = "1444046332"';
Expand All @@ -94,4 +104,60 @@ protected function createProjectFromFile($version)

return $project;
}

protected function createProjectSearchAPIFromFile()
{
$data = 'name = Search API
description = "Provides a generic API for modules offering search capabilites."
dependencies[] = entity
core = 7.x
package = Search
files[] = search_api.test
files[] = includes/callback.inc
files[] = includes/callback_add_aggregation.inc
files[] = includes/callback_add_hierarchy.inc
files[] = includes/callback_add_url.inc
files[] = includes/callback_add_viewed_entity.inc
files[] = includes/callback_bundle_filter.inc
files[] = includes/callback_comment_access.inc
files[] = includes/callback_language_control.inc
files[] = includes/callback_node_access.inc
files[] = includes/callback_node_status.inc
files[] = includes/callback_role_filter.inc
files[] = includes/callback_user_status.inc
files[] = includes/datasource.inc
files[] = includes/datasource_entity.inc
files[] = includes/datasource_external.inc
files[] = includes/datasource_multiple.inc
files[] = includes/exception.inc
files[] = includes/index_entity.inc
files[] = includes/processor.inc
files[] = includes/processor_highlight.inc
files[] = includes/processor_html_filter.inc
files[] = includes/processor_ignore_case.inc
files[] = includes/processor_stopwords.inc
files[] = includes/processor_tokenizer.inc
files[] = includes/processor_transliteration.inc
files[] = includes/query.inc
files[] = includes/server_entity.inc
files[] = includes/service.inc
configure = admin/config/search/search_api
; Information added by Drupal.org packaging script on 2016-02-26
version = "7.x-1.16+29-dev"
core = "7.x"
project = "search_api"
datestamp = "1456500713"
';

$filename = $this->createFile($data);

$info = new \Cerbere\Parser\Info();
$info->processFile($filename);
$project = $info->getProject();

return $project;
}
}

0 comments on commit de4d2b8

Please sign in to comment.