pho\Console\Console::writeLn PHP Method

writeLn() public method

Outputs a line, followed by a newline, while replacing all occurrences of '\n' in the string with PHP_EOL for cross-platform support.
public writeLn ( string $string )
$string string The string to print
    public function writeLn($string)
    {
        $this->write($string);
        fwrite($this->stream, PHP_EOL);
    }

Usage Example

Ejemplo n.º 1
0
        context('when reporter not found', function () {
            before(function () {
                $this->console = new Console(['-r', 'unkown'], 'php://output');
                $this->console->parseArguments();
            });
            it('throw pho\\Exception\\ReporterNotFoundException exception', function () {
                expect(function () {
                    $this->console->getReporterClass();
                })->toThrow('pho\\Exception\\ReporterNotFoundException');
            });
        });
    });
    context('write', function () {
        it('prints the text to the terminal', function () {
            $write = function () {
                $console = new Console([], 'php://output');
                $console->write('test');
            };
            expect($write)->toPrint('test');
        });
    });
    context('writeLn', function () {
        it('prints the text, followed by a newline, to the terminal', function () {
            $writeLn = function () {
                $console = new Console([], 'php://output');
                $console->writeLn('test');
            };
            expect($writeLn)->toPrint('test' . PHP_EOL);
        });
    });
});
All Usage Examples Of pho\Console\Console::writeLn