Closed hyanwong closed 10 years ago
OK - I had to faff around a fair bit with Git, but I hope it's now in the right state to be able to merge automatically.
Soooo... mmmmmmmaybe this is a problem with your git-faffings, but we actaully have a few errors on this branch locally. Some of them are easily resolved. I made these changes:
> git diff
diff --git a/tests/unit/test_connector_wikimedia.php b/tests/unit/test_connector_wikimedia.php
index e2e74a1..0abe28b 100644
--- a/tests/unit/test_connector_wikimedia.php
+++ b/tests/unit/test_connector_wikimedia.php
@@ -83,8 +83,8 @@ XML;
$author = $p->information();
$this->assertTrue($author['author'] == 'Karyn Sig');
$point = $p->point();
- $this->assertTrue(number_format($p->point()['latitude'], 5) === "36.13274");
- $this->assertTrue(number_format($p->point()['longitude'], 6) === "-5.348888");
+ $this->assertTrue(number_format($point['latitude'], 5) === "36.13274");
+ $this->assertTrue(number_format($point['longitude'], 6) === "-5.348888");
// We should probably check here that $p->get_data_object_parameters()['agents'][0]->role == 'photographer', and
// $p->get_data_object_parameters()['agents'][0]->fullName == 'Karyn Sig' but that relies filling data_object_parameters with
// the results of an online API query using something like $pages = array($p); \WikimediaPage::process_pages_using_API($pages);
@@ -217,11 +217,13 @@ Nothovarietas|dummy|}}";
$taxonomy1 = $p1->taxonomy($dummy_harvester->taxonav_includes);
$taxonomy2 = $p2->taxonomy($dummy_harvester->taxonav_includes);
+ $asTaxonObj = $taxonomy1->asEoLtaxonObject();
+
//test whether recursive includes have managed to find the kingdom name
- $this->assertTrue($taxonomy1->asEoLtaxonObject()["kingdom"] == "Plantae");
+ $this->assertTrue($asTaxonObj["kingdom"] == "Plantae");
//test if we have managed to reconstruct the genus name from the species name
- $this->assertTrue($taxonomy1->asEoLtaxonObject()["genus"] == "Anacamptis");
+ $this->assertTrue($asTaxonObj["genus"] == "Anacamptis");
//test whether the scientific name is properly formed, e.g. ssp replaced with subsp.
$this->assertTrue($taxonomy1->scientificName() == html_entity_decode("Anacamptis × gennarii subsp. bornemanniae (Asch.) H.Kretzschmar, Ecca
diff --git a/vendor/wikipedia/WikimediaPage.php b/vendor/wikipedia/WikimediaPage.php
index 43c11b8..51be357 100644
--- a/vendor/wikipedia/WikimediaPage.php
+++ b/vendor/wikipedia/WikimediaPage.php
@@ -69,6 +69,9 @@ class WikimediaPage
{
$this->redirect = (string) $this->simple_xml->redirect->attributes()->title;
}
+ }else
+ {
+ $this->text = $this->title = $this->ns = $this->contributor = $this->timestamp = "";
}
}
}
And a few of those changes suggest to me that perhaps you are using a different version of PHP than we are. We're stuck on "PHP 5.3.28 (cli) (built: May 29 2014 12:50:51)" ...And while we'd love to upgrade, that's probably a long way down the path for us. :\
...But even after those changes, I still get two errors:
> php tests/run_tests.php unit/test_connector_wikimedia.php
All tests
UnitTest => php_active_record\test_connector_wikimedia
testMediaOnPage
testGPSandFlickr
testUnicodeInFilenamesAndDescriptions
testRecursiveIncludesPlusSubspeciesVarietiesAndHybrids
1) at [/Users/jrice/php_code/tests/unit/test_connector_wikimedia.php line 229]
in testRecursiveIncludesPlusSubspeciesVarietiesAndHybrids
in php_active_record\test_connector_wikimedia
2) at [/Users/jrice/php_code/tests/unit/test_connector_wikimedia.php line 230]
in testRecursiveIncludesPlusSubspeciesVarietiesAndHybrids
in php_active_record\test_connector_wikimedia
testTrancludedCategoriesAndGalleries
testTaxonomyConflict
FAILURES!!!
Test cases run: 1/1, Passes: 22, Failures: 2, Exceptions: 0
Tests ran in 0.362967 seconds
...And it's not immediately obvious to me what went wrong, so we've got to lob the ball back to your court.
Sorry!
Hmm, just made your changes. I've also changed what I think are the problematic lines, so that the variables are assigned before the test line, i.e.
$scientificName2 = $taxonomy2->scientificName();
$this->assertTrue($scientificName2 === html_entity_decode("× Anacamptis gennarii var. dummy"));
The tests all pass for me, but I've hacked around the testing framework a bit, so that I don't need to run a database or full EoL setup to get this working. If it doesn't work, could you stick
echo $taxonomy2->scientificName()."\n";
echo bin2hex($taxonomy2->scientificName())."\n";
echo html_entity_decode("× Anacamptis gennarii var. dummy")."\n";
echo bin2hex(html_entity_decode("× Anacamptis gennarii var. dummy"))."\n";
on line 227 of test_connector_wikimedia.php, and show me the output, so that I can at least see why the strings look different. I wonder if the non-breaking space on line 1091 of WikimediaPage.php is not being translated right (didn't you have problems with that before?)
Sure. Will try that now.
Changes made as requested. I'm not sure why Github is claiming that these can't be merged automatically, and I'm a bit hopeless with Git, so perhaps you could work out what the problem is, and commit?