예제 #1
0
         $multiArray = array(array('pho', 'b', 'c'), array('a', 'test'));
         $aligned = array('pho | b    | c', 'a   | test');
         expect($formatter->alignText($multiArray, ' | '))->toEqual($aligned);
     });
 });
 context('calls to applyForeground', function () use($formatter) {
     it('can set the color black', function () use($formatter) {
         $formattedText = $formatter->black('test');
         expect($formattedText)->toEqual("test");
     });
     it('can set the color red', function () use($formatter) {
         $formattedText = $formatter->red('test');
         expect($formattedText)->toEqual("test");
     });
     it('can set the color green', function () use($formatter) {
         $formattedText = $formatter->green('test');
         expect($formattedText)->toEqual("test");
     });
     it('can set the color cyan', function () use($formatter) {
         $formattedText = $formatter->cyan('test');
         expect($formattedText)->toEqual("test");
     });
     it('can set the color white', function () use($formatter) {
         $formattedText = $formatter->white('test');
         expect($formattedText)->toEqual("test");
     });
 });
 context('calls to applyStyle', function () use($formatter) {
     it('can set the text bold', function () use($formatter) {
         $formattedText = $formatter->bold('test');
         expect($formattedText)->toEqual("test");
예제 #2
0
            expect($formattedText)->toEqual("test");
        });
        it('can set the color yellow', function () use($formatter) {
            $formattedText = $formatter->yellow('test');
            expect($formattedText)->toEqual("test");
        });
        it('can set the color white', function () use($formatter) {
            $formattedText = $formatter->white('test');
            expect($formattedText)->toEqual("test");
        });
    });
    context('calls to applyStyle', function () use($formatter) {
        it('can set the text bold', function () use($formatter) {
            $formattedText = $formatter->bold('test');
            expect($formattedText)->toEqual("test");
        });
        it('can set the text italic', function () use($formatter) {
            $formattedText = $formatter->italic('test');
            expect($formattedText)->toEqual("test");
        });
    });
    context('disableANSI', function () {
        it('disables formatting using ANSI escape codes', function () {
            $str = 'test';
            $formatter = new ConsoleFormatter();
            $formatter->disableANSI();
            expect($formatter->green($str))->toEqual($str);
            expect($formatter->italic($str))->toEqual($str);
        });
    });
});