Phalcon\Test\Unit\Logger\Adapter\FileTest::testLoggerAdapterFileOpenReadThrowsException PHP Method

testLoggerAdapterFileOpenReadThrowsException() public method

Tests if opening the file with r and logging throws exception
Since: 2014-09-13
Author: Nikos Dimopoulos ([email protected])
    public function testLoggerAdapterFileOpenReadThrowsException()
    {
        $I = $this->tester;
        $fileName = $I->getNewFileName('log', 'log');
        $this->specify("logging in a file with write mode does not create the file", function () use($fileName) {
            $params = array('mode' => 'r');
            $logger = new File($this->logPath . $fileName);
            $logger->log('Hello');
            $logger->close();
            $logger = new File($this->logPath . $fileName, $params);
            $logger->log('New Contents');
            $logger->close();
        }, ['throws' => ['Phalcon\\Logger\\Exception']]);
        $I->amInPath($this->logPath);
        $I->deleteFile($fileName);
    }
FileTest