/** * Checks if a file has been modified */ public function testHasBeenModified() { $this->copy(); $mbox = new Mail_Mbox(Mail_MboxTest::$filecopy); $this->assertTrue($mbox->open()); $this->assertFalse($mbox->hasBeenModified()); //get a new timestamp for the change sleep(1); $mbox2 = new Mail_Mbox(Mail_MboxTest::$filecopy); $this->assertTrue($mbox2->open()); $this->assertTrue($mbox2->remove(0)); $this->assertTrue($mbox2->close()); $this->assertTrue($mbox->hasBeenModified()); //This methods should not allow modifying a changed file. $err = $mbox->remove(0); $this->assertType('PEAR_Error', $err); $this->assertEquals(MAIL_MBOX_ERROR_MODIFIED, $err->getCode()); $err = $mbox->insert('From Test'); $this->assertType('PEAR_Error', $err); $this->assertEquals(MAIL_MBOX_ERROR_MODIFIED, $err->getCode()); $err = $mbox->update(0, 'From Test'); $this->assertType('PEAR_Error', $err); $this->assertEquals(MAIL_MBOX_ERROR_MODIFIED, $err->getCode()); $this->assertTrue($mbox->close()); }