Skip to content

Commit f02eb5f

Browse files
Merge pull request #617 from Smartling/WP-991-tests-and-version
fix tests, bump version (WP-991)
2 parents 2954a91 + 4e37eba commit f02eb5f

5 files changed

Lines changed: 17 additions & 72 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "smartling/wordpress-connector",
33
"license": "GPL-2.0-or-later",
4-
"version": "5.4.0",
4+
"version": "5.5.0",
55
"description": "",
66
"type": "wordpress-plugin",
77
"repositories": [

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: translation, localization, multilingual, internationalization, smartling
44
Requires at least: 5.5
55
Tested up to: 6.9
66
Requires PHP: 8.0
7-
Stable tag: 5.4.0
7+
Stable tag: 5.5.0
88
License: GPLv2 or later
99

1010
Translate content in WordPress quickly and seamlessly with Smartling, the industry-leading Translation Management System.
@@ -62,6 +62,9 @@ Additional information on the Smartling Connector for WordPress can be found [he
6262
3. Track translation status within WordPress from the Submissions Board. View overall progress of submitted translation requests as well as resend updated content.
6363

6464
== Changelog ==
65+
= 5.5.0 =
66+
* Reworked ACF configuration ingestion to improve image attachments not being found in ACF fields nested in repeater, group, or flexible_content layouts
67+
6568
= 5.4.0 =
6669
* Added support for Elementor 4
6770

smartling-connector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Plugin Name: Smartling Connector
1212
* Plugin URI: https://www.smartling.com/products/automate/integrations/wordpress/
1313
* Description: Integrate your WordPress site with Smartling to upload your content and download translations.
14-
* Version: 5.4.0
14+
* Version: 5.5.0
1515
* Author: Smartling
1616
* Author URI: https://www.smartling.com
1717
* License: GPL-2.0+

tests/IntegrationTests/testdata/acf-pro-test-definitions/acf-pro-test-definitions.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
add_action('init', function () {
1010
if (function_exists('acf_add_local_field_group')):
11-
acf_add_local_field_group(array(
11+
$group = array(
1212
'key' => 'group_5ad066ba13486',
1313
'title' => 'ACF Test Group',
1414
'fields' => array(
@@ -444,8 +444,16 @@
444444
'hide_on_screen' => '',
445445
'active' => 1,
446446
'description' => '',
447-
));
448-
447+
);
448+
acf_add_local_field_group($group);
449+
// Persist the group + fields to the DB once so the Smartling connector's
450+
// DB-only definition walker (AcfDynamicSupport::collectAcfDefinitions) sees them.
451+
if (function_exists('acf_get_field_group_post')
452+
&& function_exists('acf_import_field_group')
453+
&& !acf_get_field_group_post($group['key'])
454+
) {
455+
acf_import_field_group($group);
456+
}
449457
endif;
450458

451459

tests/Smartling/Extensions/Acf/AcfTypeDetectorTest.php

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,20 @@
55
use PHPUnit\Framework\TestCase;
66
use Smartling\Extensions\Acf\AcfDynamicSupport;
77
use Smartling\Extensions\Acf\AcfTypeDetector;
8-
use Smartling\Helpers\ArrayHelper;
98
use Smartling\Helpers\Cache;
109
use Smartling\Helpers\ContentHelper;
11-
use Smartling\Helpers\MetaFieldProcessor\BulkProcessors\MediaBasedProcessor;
1210
use Smartling\Helpers\SiteHelper;
1311
use Smartling\Helpers\WordpressFunctionProxyHelper;
14-
use Smartling\Helpers\WpObjectCache;
1512
use Smartling\Processors\ContentEntitiesIOFactory;
16-
use Smartling\Settings\SettingsManager;
17-
use Smartling\Submissions\SubmissionManager;
1813
use Smartling\Tests\Mocks\WordpressFunctionsMockHelper;
1914

2015
class AcfTypeDetectorTest extends TestCase
2116
{
22-
private $acfStores;
2317
protected function setUp(): void
2418
{
25-
global $acf_stores;
26-
$this->acfStores = $acf_stores;
2719
WordpressFunctionsMockHelper::injectFunctionsMocks();
2820
}
2921

30-
protected function tearDown(): void
31-
{
32-
global $acf_stores;
33-
$acf_stores = $this->acfStores;
34-
}
35-
3622
/**
3723
* @dataProvider providerGetProcessorByMetaFields
3824
*/
@@ -74,56 +60,4 @@ private function providerGetProcessorByMetaFields()
7460
];
7561
}
7662

77-
public function testGetProcessorForGutenberg()
78-
{
79-
global $acf_stores;
80-
if (!class_exists('ACF_Data')) {
81-
$this->markTestSkipped('No ACF data found. This is ok when running tests with no ACF plugin or no wordpress loaded. The test will work when running as part of integration suite.');
82-
}
83-
$groups = $this->createPartialMock('ACF_Data', ['get_data']);
84-
$groups->method('get_data')->willReturn([]);
85-
$fields = $this->createPartialMock('ACF_Data', ['get_data']);
86-
$fields->method('get_data')->willReturn([
87-
'field_5eb1344b55a84' => [
88-
'global_type' => 'field',
89-
'type' => 'image',
90-
'name' => 'media',
91-
'key' => 'field_5eb1344b55a84',
92-
'parent' => '',
93-
]
94-
]);
95-
$acf_stores = [
96-
'local-groups' => $groups,
97-
'local-fields' => $fields,
98-
];
99-
100-
$settingsManager = $this->getMockBuilder(SettingsManager::class)->disableOriginalConstructor()->getMock();
101-
$settingsManager->method('getActiveProfiles')->willReturn([]);
102-
$siteHelper = $this->createMock(SiteHelper::class);
103-
$siteHelper->method('listBlogs')->willReturn([]);
104-
105-
$ads = new AcfDynamicSupport(
106-
new ArrayHelper(),
107-
$settingsManager,
108-
$siteHelper,
109-
$this->createMock(SubmissionManager::class),
110-
new WordpressFunctionProxyHelper(),
111-
);
112-
$ads->run();
113-
114-
$fields = json_decode('{"entity\/post_content\/acf\/testimonial\/data\/media":"297",' .
115-
'"entity\/post_content\/acf\/testimonial\/data\/_media":"field_5eb1344b55a84"}', true);
116-
self::assertInstanceOf(
117-
MediaBasedProcessor::class,
118-
(new AcfTypeDetector(
119-
$ads,
120-
new WpObjectCache(),
121-
new ContentHelper(
122-
$this->createMock(ContentEntitiesIOFactory::class),
123-
$siteHelper,
124-
new WordpressFunctionProxyHelper(),
125-
)
126-
))->getProcessorForGutenberg(array_keys($fields)[0], $fields)
127-
);
128-
}
12963
}

0 commit comments

Comments
 (0)