/[drupal]/contributions/modules/potx/tests/potx.test
ViewVC logotype

Diff of /contributions/modules/potx/tests/potx.test

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.4.3 by goba, Tue Nov 17 12:35:09 2009 UTC revision 1.1.4.4 by goba, Tue Nov 17 14:20:43 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: potx.test,v 1.1.4.2 2009/11/17 12:33:17 goba Exp $  // $Id: potx.test,v 1.1.4.3 2009/11/17 12:35:09 goba Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 7  Line 7 
7   */   */
8    
9  class PotxTestCase extends DrupalWebTestCase {  class PotxTestCase extends DrupalWebTestCase {
10    
11    public static function getInfo() {    public static function getInfo() {
12      return array(      return array(
13        'name' => t('Translation template extractor'),        'name' => t('Translation template extractor'),
# Line 44  class PotxTestCase extends DrupalWebTest Line 44  class PotxTestCase extends DrupalWebTest
44      $this->assertMsgID('one more test potx permission');      $this->assertMsgID('one more test potx permission');
45      $this->assertMsgID('1 test string');      $this->assertMsgID('1 test string');
46      $this->assertPluralID('@count test strings');      $this->assertPluralID('@count test strings');
47    
48      // Installer string should not appear in runtime output.      // Installer string should not appear in runtime output.
49      $this->assertNoMsgID('Installer only test string');      $this->assertNoMsgID('Installer only test string');
50      $this->assertMsgID('Dynamic callback test string');      $this->assertMsgID('Dynamic callback test string');
51    
52      // No context support yet.      // No context support yet.
53      $this->assertNoMsgIDContext('Test string in context', 'Test context');      $this->assertNoMsgIDContext('Test string in context', 'Test context');
54      $this->assertMsgID('Test string in context');      $this->assertMsgID('Test string in context');
# Line 59  class PotxTestCase extends DrupalWebTest Line 59  class PotxTestCase extends DrupalWebTest
59      $this->assertMsgID('Dynamic callback test string');      $this->assertMsgID('Dynamic callback test string');
60      $this->assertNoMsgID('1 test string');      $this->assertNoMsgID('1 test string');
61      $this->assertNoMsgID('This is a test string.');      $this->assertNoMsgID('This is a test string.');
62    
63      $this->assert(count($this->potx_status) == 3, t('3 error messages found'));      $this->assert(count($this->potx_status) == 3, t('3 error messages found'));
64      $this->assert($this->potx_status[0][0] == $this->empty_error, t('First empty error found.'));      $this->assert($this->potx_status[0][0] == $this->empty_error, t('First empty error found.'));
65      $this->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));      $this->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));
# Line 84  class PotxTestCase extends DrupalWebTest Line 84  class PotxTestCase extends DrupalWebTest
84      $this->assertMsgID('one more test potx permission');      $this->assertMsgID('one more test potx permission');
85      $this->assertMsgID('1 test string');      $this->assertMsgID('1 test string');
86      $this->assertPluralID('@count test strings');      $this->assertPluralID('@count test strings');
87    
88      // Installer string should not appear in runtime output.      // Installer string should not appear in runtime output.
89      $this->assertNoMsgID('Installer only test string');      $this->assertNoMsgID('Installer only test string');
90      $this->assertMsgID('Dynamic callback test string');      $this->assertMsgID('Dynamic callback test string');
91    
92      // No context support yet.      // No context support yet.
93      $this->assertNoMsgIDContext('Test string in context', 'Test context');      $this->assertNoMsgIDContext('Test string in context', 'Test context');
94      $this->assertMsgID('Test string in context');      $this->assertMsgID('Test string in context');
# Line 105  class PotxTestCase extends DrupalWebTest Line 105  class PotxTestCase extends DrupalWebTest
105      $this->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));      $this->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));
106      $this->assert($this->potx_status[2][0] == $this->empty_error, t('Third empty error found.'));      $this->assert($this->potx_status[2][0] == $this->empty_error, t('Third empty error found.'));
107    }    }
108    
109    /**    /**
110     * Test parsing of Drupal 7 module.     * Test parsing of Drupal 7 module.
111     */     */
# Line 131  class PotxTestCase extends DrupalWebTest Line 131  class PotxTestCase extends DrupalWebTest
131    
132      $this->assertMsgID('1 test string');      $this->assertMsgID('1 test string');
133      $this->assertPluralID('@count test strings');      $this->assertPluralID('@count test strings');
134    
135      $this->assertNoMsgID('Installer only test string');      $this->assertNoMsgID('Installer only test string');
136      $this->assertMsgID('Dynamic callback test string');      $this->assertMsgID('Dynamic callback test string');
137    
138      // Context support added.      // Context support added.
139      $this->assertMsgIDContext('Test string in context', 'Test context');      $this->assertMsgIDContext('Test string in context', 'Test context');
140    
# Line 157  class PotxTestCase extends DrupalWebTest Line 157  class PotxTestCase extends DrupalWebTest
157      // Parse and build the Drupal 6 module file.      // Parse and build the Drupal 6 module file.
158      $filename = drupal_get_path('module', 'potx') .'/tests/potx_test_6.info';      $filename = drupal_get_path('module', 'potx') .'/tests/potx_test_6.info';
159      $this->parseFile($filename, POTX_API_6);      $this->parseFile($filename, POTX_API_6);
160    
161      // Look for name, description and package name extracted.      // Look for name, description and package name extracted.
162      $this->assertMsgID('Translation template extractor tester');      $this->assertMsgID('Translation template extractor tester');
163      $this->assertMsgID('Test description');      $this->assertMsgID('Test description');
# Line 189  class PotxTestCase extends DrupalWebTest Line 189  class PotxTestCase extends DrupalWebTest
189    private function parseFile($filename, $api_version, $string_mode = POTX_STRING_RUNTIME) {    private function parseFile($filename, $api_version, $string_mode = POTX_STRING_RUNTIME) {
190      global $_potx_store, $_potx_strings, $_potx_install;      global $_potx_store, $_potx_strings, $_potx_install;
191      $_potx_store = $_potx_strings = $_potx_install = array();      $_potx_store = $_potx_strings = $_potx_install = array();
192    
193      potx_status('set', POTX_STATUS_STRUCTURED);      potx_status('set', POTX_STATUS_STRUCTURED);
194      _potx_process_file($filename, 0, '_potx_save_string', '_potx_save_version', $api_version);      _potx_process_file($filename, 0, '_potx_save_string', '_potx_save_version', $api_version);
195      _potx_build_files($string_mode, POTX_BUILD_SINGLE, 'general', '_potx_save_string', '_potx_save_version', '_potx_get_header', NULL, NULL, $api_version);      _potx_build_files($string_mode, POTX_BUILD_SINGLE, 'general', '_potx_save_string', '_potx_save_version', '_potx_get_header', NULL, NULL, $api_version);
# Line 202  class PotxTestCase extends DrupalWebTest Line 202  class PotxTestCase extends DrupalWebTest
202      $this->potx_status = potx_status('get', TRUE);      $this->potx_status = potx_status('get', TRUE);
203      // $this->pass(var_export($this->potx_status, TRUE));      // $this->pass(var_export($this->potx_status, TRUE));
204  }  }
205    
206    /**    /**
207     * Helper function to assert an msgid construct in the .po file.     * Helper function to assert an msgid construct in the .po file.
208     */     */

Legend:
Removed from v.1.1.4.3  
changed lines
  Added in v.1.1.4.4

  ViewVC Help
Powered by ViewVC 1.1.3