testLanguagesSyntax()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 2
Metric Value
cc 3
eloc 8
c 2
b 1
f 2
nc 2
nop 0
dl 0
loc 15
rs 9.4285

1 Method

Rating   Name   Duplication   Size   Complexity  
A CodeReviewElggCompatibilityTest.php ➔ add_translation() 0 3 1
1
<?php
2
class CodeReviewElggCompatibilityTest extends PHPUnit_Framework_TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
3
4
	/**
5
	 * Checks if file is loadable for current version of PHP. Regression test after problems with 1.0.2 version.
6
	 */
7
	public function testLanguagesSyntax() {
8
9
		if (!function_exists('add_translation')) {
10
			//whatever, we just test syntax correctness
11
12
			function add_translation($country_code, $language_array) {
0 ignored issues
show
Unused Code introduced by
The parameter $country_code is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $language_array is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
				return true;
14
			}
15
		}
16
17
		$path = dirname(dirname(dirname(__FILE__))) . '/languages/en.php';
18
		$this->assertTrue(file_exists($path));
19
		$languages = include($path);
20
		$this->assertTrue($languages === 1 || is_array($languages));
21
	}
22
}