Skip to content

Commit

Permalink
"Landing page" missing in data.json (#2032)
Browse files Browse the repository at this point in the history
* Tests for landingPage in data.json (#1975)

* Tests for node:url in landingPage form (#1975)

* Adds landingPage to data.json feed (#1975)

* Updates data.json path to server and adds CHANGELOG

* reads data.json file into array instead of string

* removes data. from json file

* removes data. from json file and switches back to file get contents function

* Try restoring data.json path to dataJsonTest.php

* Fix linter.

* Trying unit tests first.

Observed that tests passes on CIRCLE before behat tests are run.
Checking to see if something left over by behat is causing issue
by running unittests first.

* Reinstall dkan between unit tests and behavioral tests.

* Rename dataJsonTest.php DataJsonTest.php to match class name.

* Add ODSM memory settings to circle.settings.php

* Fix php coding standards issues on circle.settings.php

* Make linter happy.

* Use docker db settings in circle.
  • Loading branch information
dafeder authored Aug 9, 2017
1 parent fb6a1bc commit cf4c2c1
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .ahoy/dkan.ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ commands:
if [ ! -d backups ]; then
mkdir backups
fi
if [ -f backups/last_install.sql ] && ahoy confirm "An existing installation backup exists at backups/last_install.sql, do you want to use that instead of reinstalling from scratch?"; then
if [ -f backups/last_install.sql ] && ahoy confirm "{{args}} An existing installation backup exists at backups/last_install.sql, do you want to use that instead of reinstalling from scratch?"; then
ahoy drush sql-drop -y && \
echo "... Removed tables, restoring DB"
Expand Down
12 changes: 8 additions & 4 deletions .ahoy/utils.ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ version: 0.0.0
commands:
confirm:
cmd: |
read -r -p "{{args}} [y/N] " response
if [ "$response" = y ] || [ "$response" = Y ];
then
if [[ "{{args}}" == *--yes* ]]; then
true
else
false
read -r -p "{{args}} [y/N] " response
if [ "$response" = y ] || [ "$response" = Y ];
then
true
else
false
fi
fi
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
7.x-1.14.x
----------
- #1975 Add landingPage to data.json feed.
- #1967 Added search title to /search panels.
- #1997 Recline.view.nvd3.js: Fixed tooltips that were not being displayed when using some percentage formats.
- #1988 Count and delete resources on Harvest source deletion.
Expand Down
11 changes: 6 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ checkout:
database:
pre:
- echo -e 'secure_file_priv = ""' | sudo sh -c "cat >> /etc/mysql/my.cnf"
- echo -e 'max_allowed_packet = 128M' | sudo sh -c "cat >> /etc/mysql/my.cnf"
- echo -e 'innodb_buffer_pool_size=256M ' | sudo sh -c "cat >> /etc/mysql/my.cnf"
- sudo /usr/sbin/service mysql restart

## Customize dependencies
Expand Down Expand Up @@ -79,14 +81,13 @@ dependencies:
test:
override:
- ahoy dkan lint
- PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush en --yes dkan_harvest_test
- ahoy dkan unittests:
parallel: false
- ahoy dkan reinstall --yes
- ruby dkan/.ahoy/.scripts/circle-behat.rb docroot/profiles/dkan/test/features:
timeout: 1200
parallel: true
- PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush en --yes dkan_migrate_base_example
- PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush en --yes dkan_harvest_test
- PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush dis --yes dkan_default_content
- PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush pm-uninstall --yes dkan_default_content
- ahoy dkan unittests
post:
- echo $CIRCLE_ARTIFACTS; cp -av dkan/test/assets $CIRCLE_ARTIFACTS:
parallel: true
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ function open_data_schema_map_dkan_open_data_schema_apis_defaults() {
'type' => 'array',
),
'landingPage' => array(
'value' => '[node:field_landing_page:url]',
'value' => '[node:field_landing_page:url] || [node:url]',
'type' => 'string',
),
'language' => array(
Expand Down
26 changes: 22 additions & 4 deletions test/circle.settings.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

$databases = array (
/**
* @file
* Circle-specific settings.
*/

$databases = array(
'default' =>
array (
array(
'default' =>
array (
array(
'database' => 'circle_test',
'username' => 'ubuntu',
'password' => '',
Expand All @@ -15,7 +20,20 @@
'pdo' => array(
PDO::MYSQL_ATTR_LOCAL_INFILE => 1,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,
)
),
),
),
);

// Conditionally manage memory.
$high_memory_paths = array();

// ODSM edit forms.
$high_memory_paths[] = 'admin/config/services/odsm/edit';
// Standarize node edit paths for validation.
$current_path = preg_replace("/\/\d+/", '/%node', $_GET['q']);
foreach ($high_memory_paths as $high_memory_path) {
if ((strpos($current_path, $high_memory_path) === 0)) {
ini_set('memory_limit', '512M');
}
}
7 changes: 7 additions & 0 deletions test/features/dataset.admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ Feature: Dataset Features
When I click "Edit"
Then I select "- None -" from "edit-field-public-access-level-und"
And I should not see "Rights on Project Open Data"

@api
Scenario: ODSM data.json 1.1 mapping
Given I am logged in as a user with the "administrator" role
And I go to "admin/config/services/odsm/edit/data_json_1_1"
Then the "Homepage URL (landingPage)" field should contain "[node:field_landing_page:url] || [node:url]"

23 changes: 23 additions & 0 deletions test/phpunit/dkan_dataset/DataJsonTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Class DataJsonTest.
*
* Tests for landingPage key in /data.json file datasets.
*/
class DataJsonTest extends PHPUnit_Framework_TestCase {

/**
* Verify data.json exists.
*/
public function testDataJson() {
$base_url = 'http://127.0.0.1:8888/';
$path = 'data.json';
$file = $base_url . $path;
$contents = file_get_contents($file);
$decoded = json_decode($contents, TRUE);
// Asserts that landingPage key is in data.json file.
$this->assertArrayHasKey('landingPage', $decoded['dataset'][0]);
}

}
1 change: 1 addition & 0 deletions test/phpunit/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<file>dkan_workflow/DkanWorkflowTest.php</file>-->
</testsuite>
<testsuite name="DKAN Dataset Test Suite">
<file>dkan_dataset/DataJsonTest.php</file>
<file>dkan_dataset/getRemoteFileInfoTest.php</file>
<file>dkan_dataset/reclineEmbedCacheTest.php</file>
</testsuite>
Expand Down

0 comments on commit cf4c2c1

Please sign in to comment.