| | 227 | |
| | 228 | /** |
| | 229 | * @group comment |
| | 230 | */ |
| | 231 | function test_find_function_calls_with_inline_c_style_comment() { |
| | 232 | $this->assertEquals( array( array( |
| | 233 | 'name' => '__', 'args' => array( 'on' ), 'line' => 2, |
| | 234 | ) ), |
| | 235 | $this->extractor->find_function_calls( array( '__' ), |
| | 236 | "<?php |
| | 237 | __( // unrelated comment |
| | 238 | 'on' );" |
| | 239 | ) |
| | 240 | ); |
| | 241 | $this->assertEquals( array( array( |
| | 242 | 'name' => '_n', 'args' => array( '1 thought', '%d thoughts' ), 'line' => 2, |
| | 243 | ) ), |
| | 244 | $this->extractor->find_function_calls( array( '_n' ), |
| | 245 | "<?php |
| | 246 | _n( // unrelated comment |
| | 247 | '1 thought', |
| | 248 | '%d thoughts' |
| | 249 | );" |
| | 250 | ) |
| | 251 | ); |
| | 252 | } |
| | 253 | |
| | 254 | /** |
| | 255 | * @group comment |
| | 256 | */ |
| | 257 | function test_find_function_calls_with_inline_c_style_translator_comment() { |
| | 258 | $this->assertEquals( array( array( |
| | 259 | 'name' => '__', 'args' => array( 'on' ), 'line' => 2, |
| | 260 | 'comment' => "translators: I'd hate for you to miss helpful comments", |
| | 261 | ) ), |
| | 262 | $this->extractor->find_function_calls( array( '__' ), |
| | 263 | "<?php |
| | 264 | __( // translators: I'd hate for you to miss helpful comments |
| | 265 | 'on' );" |
| | 266 | ) |
| | 267 | ); |
| | 268 | $this->assertEquals( array( array( |
| | 269 | 'name' => '_n', 'args' => array( '1 thought', '%d thoughts' ), 'line' => 2, |
| | 270 | 'comment' => "translators: I'd hate for you to miss helpful comments", |
| | 271 | ) ), |
| | 272 | $this->extractor->find_function_calls( array( '_n' ), |
| | 273 | "<?php |
| | 274 | _n( // translators: I'd hate for you to miss helpful comments |
| | 275 | '1 thought', |
| | 276 | '%d thoughts' |
| | 277 | );" |
| | 278 | ) |
| | 279 | ); |
| | 280 | } |