From 5dedc4c400ec71e46a9ea641dd18c914b11c1096 Mon Sep 17 00:00:00 2001 From: webchick Date: Tue, 27 Sep 2011 12:06:35 -0700 Subject: Issue #1226796 by sun, catch, Damien Tournoud: Fixed Not equal operator '!=' is not supported by all databases, must be '<>'. --- modules/simpletest/tests/entity_query.test | 86 ++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) (limited to 'modules/simpletest/tests') diff --git a/modules/simpletest/tests/entity_query.test b/modules/simpletest/tests/entity_query.test index 0fe8106ef..3c53eae47 100644 --- a/modules/simpletest/tests/entity_query.test +++ b/modules/simpletest/tests/entity_query.test @@ -719,6 +719,31 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { array('test_entity', 3), ), t('Test the "equal to" operation on a field.')); + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity_bundle_key') + ->propertyCondition('ftid', 3, '<>'); + $this->assertEntityFieldQuery($query, array( + array('test_entity_bundle_key', 1), + array('test_entity_bundle_key', 2), + array('test_entity_bundle_key', 4), + array('test_entity_bundle_key', 5), + array('test_entity_bundle_key', 6), + ), t('Test the "not equal to" operation on a property.')); + + $query = new EntityFieldQuery(); + $query->fieldCondition($this->fields[0], 'value', 3, '<>'); + $this->assertEntityFieldQuery($query, array( + array('test_entity_bundle_key', 1), + array('test_entity_bundle_key', 2), + array('test_entity_bundle_key', 4), + array('test_entity_bundle_key', 5), + array('test_entity_bundle_key', 6), + array('test_entity', 1), + array('test_entity', 2), + array('test_entity', 4), + ), t('Test the "not equal to" operation on a field.')); + $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity_bundle_key') @@ -1084,6 +1109,15 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { array('test_entity', 1), ), t('Test with a delta meta condition.')); + // Test language field meta condition. + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldLanguageCondition($this->fields[0], LANGUAGE_NONE, '<>'); + $this->assertEntityFieldQuery($query, array( + array('test_entity', 1), + ), t('Test with a language meta condition.')); + // Test language field meta condition. $query = new EntityFieldQuery(); $query @@ -1110,6 +1144,16 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { ->fieldDeltaCondition($this->fields[0], 1, '>=', 'group'); $this->assertEntityFieldQuery($query, array(), t('Test with a grouped delta meta condition (empty result set).')); + // Test language grouping. + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldCondition($this->fields[0], 'value', 0, '=', NULL, 'group') + ->fieldLanguageCondition($this->fields[0], 'en', '<>', NULL, 'group'); + $this->assertEntityFieldQuery($query, array( + array('test_entity', 1), + ), t('Test with a grouped language meta condition.')); + // Test language grouping. $query = new EntityFieldQuery(); $query @@ -1120,6 +1164,13 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { array('test_entity', 1), ), t('Test with a grouped language meta condition.')); + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldCondition($this->fields[0], 'value', 0, '=', NULL, 'group') + ->fieldLanguageCondition($this->fields[0], LANGUAGE_NONE, '<>', NULL, 'group'); + $this->assertEntityFieldQuery($query, array(), t('Test with a grouped language meta condition (empty result set).')); + $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity', '=') @@ -1127,6 +1178,17 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { ->fieldLanguageCondition($this->fields[0], LANGUAGE_NONE, '!=', NULL, 'group'); $this->assertEntityFieldQuery($query, array(), t('Test with a grouped language meta condition (empty result set).')); + // Test delta and language grouping. + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldCondition($this->fields[0], 'value', 0, '=', 'delta', 'language') + ->fieldDeltaCondition($this->fields[0], 1, '<', 'delta', 'language') + ->fieldLanguageCondition($this->fields[0], 'en', '<>', 'delta', 'language'); + $this->assertEntityFieldQuery($query, array( + array('test_entity', 1), + ), t('Test with a grouped delta + language meta condition.')); + // Test delta and language grouping. $query = new EntityFieldQuery(); $query @@ -1138,6 +1200,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { array('test_entity', 1), ), t('Test with a grouped delta + language meta condition.')); + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldCondition($this->fields[0], 'value', 0, '=', 'delta', 'language') + ->fieldDeltaCondition($this->fields[0], 1, '>=', 'delta', 'language') + ->fieldLanguageCondition($this->fields[0], 'en', '<>', 'delta', 'language'); + $this->assertEntityFieldQuery($query, array(), t('Test with a grouped delta + language meta condition (empty result set, delta condition unsatisifed).')); + $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity', '=') @@ -1146,6 +1216,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { ->fieldLanguageCondition($this->fields[0], 'en', '!=', 'delta', 'language'); $this->assertEntityFieldQuery($query, array(), t('Test with a grouped delta + language meta condition (empty result set, delta condition unsatisifed).')); + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldCondition($this->fields[0], 'value', 0, '=', 'delta', 'language') + ->fieldDeltaCondition($this->fields[0], 1, '<', 'delta', 'language') + ->fieldLanguageCondition($this->fields[0], LANGUAGE_NONE, '<>', 'delta', 'language'); + $this->assertEntityFieldQuery($query, array(), t('Test with a grouped delta + language meta condition (empty result set, language condition unsatisifed).')); + $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity', '=') @@ -1154,6 +1232,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { ->fieldLanguageCondition($this->fields[0], LANGUAGE_NONE, '!=', 'delta', 'language'); $this->assertEntityFieldQuery($query, array(), t('Test with a grouped delta + language meta condition (empty result set, language condition unsatisifed).')); + $query = new EntityFieldQuery(); + $query + ->entityCondition('entity_type', 'test_entity', '=') + ->fieldCondition($this->fields[0], 'value', 0, '=', 'delta', 'language') + ->fieldDeltaCondition($this->fields[0], 1, '>=', 'delta', 'language') + ->fieldLanguageCondition($this->fields[0], LANGUAGE_NONE, '<>', 'delta', 'language'); + $this->assertEntityFieldQuery($query, array(), t('Test with a grouped delta + language meta condition (empty result set, both conditions unsatisifed).')); + $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity', '=') -- cgit v1.2.3