From 812727261e36446796e81317419c5e5d79bf12c4 Mon Sep 17 00:00:00 2001 From: Rene Reimann Date: Mon, 18 Jan 2016 19:44:59 +0100 Subject: [PATCH] #22 implement origin_attachment_url --- inc/Import/Type/ImportPostInterface.php | 6 ++++++ inc/Import/Type/WpImportPost.php | 17 ++++++++++++++++- .../Unit/Import/Service/WpPostParserTest.php | 4 +++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/inc/Import/Type/ImportPostInterface.php b/inc/Import/Type/ImportPostInterface.php index caa01db..06846f9 100644 --- a/inc/Import/Type/ImportPostInterface.php +++ b/inc/Import/Type/ImportPostInterface.php @@ -98,4 +98,10 @@ public function meta(); * @return array */ public function locale_relations(); + + + /** + * @return string + */ + public function origin_attachment_url(); } \ No newline at end of file diff --git a/inc/Import/Type/WpImportPost.php b/inc/Import/Type/WpImportPost.php index 09c59e0..e1fa240 100644 --- a/inc/Import/Type/WpImportPost.php +++ b/inc/Import/Type/WpImportPost.php @@ -108,6 +108,11 @@ class WpImportPost implements ImportPostInterface { */ private $locale_relations = array(); + /** + * @var string + */ + private $origin_attachment_url = ''; + /** * @var Common\ParameterSanitizerInterface */ @@ -173,7 +178,8 @@ private function set_attributes( Array $attributes ) { 'password' => 'string', 'terms' => 'array', 'meta' => 'array', - 'locale_relations' => 'array' + 'locale_relations' => 'array', + 'origin_attachment_url' => 'string' ); $valid_attributes = $this->param_sanitizer @@ -403,4 +409,13 @@ public function locale_relations() { return $this->locale_relations; } + + + /** + * @return string + */ + public function origin_attachment_url() { + + return $this->origin_attachment_url; + } } \ No newline at end of file diff --git a/tests/phpunit/Unit/Import/Service/WpPostParserTest.php b/tests/phpunit/Unit/Import/Service/WpPostParserTest.php index 27c8476..a5b6277 100644 --- a/tests/phpunit/Unit/Import/Service/WpPostParserTest.php +++ b/tests/phpunit/Unit/Import/Service/WpPostParserTest.php @@ -233,7 +233,7 @@ public function parse_post_test_data() { 'date' => '2013-10-27 20:13:05', 'comment_status' => 'open', 'ping_status' => 'open', - 'type' => 'post', + 'type' => 'attachment', 'is_sticky' => 0, 'origin_link' => 'http://wpml.to.mlp/hello-world/', 'excerpt' => '', @@ -313,6 +313,8 @@ public function parse_post_test_data() { ) ); + print_r( $data ); + return $data; }