Skip to content
Browse files

added a test case to implement better error handling for the save() m…

…ethod
  • Loading branch information...
1 parent 5913227 commit 7bc34a3420768479a5c5862b35021bd0553af4a1 @ppadron committed
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/AugeasSaveTest.php
View
24 tests/AugeasSaveTest.php
@@ -0,0 +1,24 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+class AugeasSaveTest extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->augeas = new Augeas(dirname(__FILE__) . "/root");
+ }
+
+ public function testShouldSaveWhenNothingWasChanged()
+ {
+ $this->assertEquals(true, $this->augeas->save());
+ }
+
+ public function testShouldThrowExceptionIfSaveFailsWithMalformedFile()
+ {
+ $this->expectedException = 'AugeasException';
+ $this->augeas->rm('/files/etc/hosts/1/ipaddr');
+ $this->augeas->save();
+ }
+
+}

0 comments on commit 7bc34a3

Please sign in to comment.
Something went wrong with that request. Please try again.