/** * @expectedException RuntimeException */ public function testShouldThrowExceptionWhenDeletionNotPermitted() { $this->root->chmod(0555); $this->root->getChild('testfile2')->chmod(0555); $localDelete = new DefaultDelete($this->root->url() . '/testfile2'); $localDelete->execute(); }
/** * Test dump to file throws exception if file does not exist and the directory is not writable. */ public function testDumpToFileThrowsExceptionIfFileDoesNotExistAndTheDirectoryIsNotWritable() { $mock = $this->getMockForAbstractClass('SportTrackerConnector\\Workout\\Dumper\\AbstractDumper'); $this->root->chmod(00); $file = vfsStream::url('root/workout.tst'); $workoutMock = $this->getMock('SportTrackerConnector\\Workout\\Workout'); $this->setExpectedException('InvalidArgumentException', 'Directory for output file "vfs://root/workout.tst" is not writable.'); $mock->dumpToFile($workoutMock, $file); }
/** * @test */ public function taskFailsOnWritingFailure() { $this->dir->chmod(0); $result = $this->task->run(); $this->assertFalse($result->wasSuccessful()); }