Merge lp:~stevanr/linaro-license-protection/phpunit-wrong-fail-message into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Stevan Radaković
Status: Merged
Approved by: Stevan Radaković
Approved revision: 78
Merged at revision: 77
Proposed branch: lp:~stevanr/linaro-license-protection/phpunit-wrong-fail-message
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 75 lines (+25/-14)
2 files modified
tests/LicenseHelperTest.php (+20/-10)
tests/test_php_unit.py (+5/-4)
To merge this branch: bzr merge lp:~stevanr/linaro-license-protection/phpunit-wrong-fail-message
Reviewer Review Type Date Requested Status
Georgy Redkozubov Approve
Linaro Infrastructure Pending
Review via email: mp+107600@code.launchpad.net

Description of the change

Fix php unit wrong error message when tests are failing - #1005452

To post a comment you must log in.
78. By Stevan Radaković

Fix php unit wrong error message when tests are failing.

Revision history for this message
Georgy Redkozubov (gesha) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/LicenseHelperTest.php'
2--- tests/LicenseHelperTest.php 2012-05-11 14:02:26 +0000
3+++ tests/LicenseHelperTest.php 2012-05-29 07:40:23 +0000
4@@ -6,6 +6,18 @@
5 {
6
7 private $temp_filename;
8+ private $temp_link;
9+
10+ public function setUp() {
11+ $this->temp_link = sys_get_temp_dir() . "/temp_link";
12+ }
13+
14+ public function tearDown() {
15+ if (file_exists($this->temp_link)) {
16+ unlink($this->temp_link);
17+ }
18+ }
19+
20
21 /**
22 * Running checkFile on a directory path returns false.
23@@ -21,11 +33,10 @@
24 public function test_checkFile_link()
25 {
26 $this->temp_filename = tempnam(sys_get_temp_dir(), "unittest");
27- symlink($this->temp_filename, "test_link");
28-
29- $this->assertTrue(LicenseHelper::checkFile("test_link"));
30-
31- unlink("test_link");
32+ symlink($this->temp_filename, $this->temp_link);
33+
34+ $this->assertTrue(LicenseHelper::checkFile($this->temp_link));
35+
36 unlink($this->temp_filename);
37 }
38
39@@ -36,12 +47,11 @@
40 public function test_checkFile_brokenLink()
41 {
42 $this->temp_filename = tempnam(sys_get_temp_dir(), "unittest");
43- symlink($this->temp_filename, "test_link");
44+ symlink($this->temp_filename, $this->temp_link);
45+
46+ $this->assertTrue(LicenseHelper::checkFile($this->temp_link));
47+
48 unlink($this->temp_filename);
49-
50- $this->assertTrue(LicenseHelper::checkFile("test_link"));
51-
52- unlink("test_link");
53 }
54
55 /**
56
57=== modified file 'tests/test_php_unit.py'
58--- tests/test_php_unit.py 2012-05-17 18:44:59 +0000
59+++ tests/test_php_unit.py 2012-05-29 07:40:23 +0000
60@@ -16,10 +16,11 @@
61 def setUp(self):
62 super(PhpUnitTest, self).setUp()
63 self.xml_path = tempfile.mkstemp()[1]
64- if subprocess.Popen(['phpunit', '--log-junit',
65- self.xml_path, 'tests/LicenseHelperTest'],
66- stdout=open('/dev/null', 'w'),
67- stderr=subprocess.STDOUT).wait():
68+ returncode = subprocess.Popen(['phpunit', '--log-junit',
69+ self.xml_path, 'tests/LicenseHelperTest'],
70+ stdout=open('/dev/null', 'w'),
71+ stderr=subprocess.STDOUT).wait()
72+ if returncode == -1:
73 raise CommandNotFoundException("phpunit command not found. Please "
74 "install phpunit package and rerun tests.")
75 self.xml_data = xml.etree.ElementTree.parse(self.xml_path)

Subscribers

People subscribed via source and target branches