Esempio n. 1
0
 public function testChainer()
 {
     $tmp = $this->getTmp();
     copy(__DIR__ . '/../files/.src/chainer.php', $tmp . '_chainer.sbp.php');
     ob_start();
     sbp($tmp . '_chainer');
     $contents = ob_get_contents();
     ob_end_clean();
     $this->assertSame("trucmachinchose", $contents);
 }
Esempio n. 2
0
 public function testSuperMethods()
 {
     $tmp = $this->getTmp();
     Sbp::prod();
     copy(__DIR__ . '/../files/.src/return.php', $tmp . '_return_prod.sbp.php');
     file_put_contents($tmp . '__return_prod.php', '<?php return 1138;');
     touch($tmp . '__return_prod.php', time() - 3600);
     $this->assertSame(1138, sbp_include_once($tmp . '_return_prod'));
     $this->assertSame(1138, sbp($tmp . '_return_prod'));
     Sbp::dev();
     copy(__DIR__ . '/../files/.src/return.php', $tmp . '_return_dev.sbp.php');
     file_put_contents($tmp . '__return_dev.php', '<?php return 1138;');
     touch($tmp . '__return_dev.php', time() - 3600);
     $this->assertSame(42, sbp_include_once($tmp . '_return_dev'));
     $this->assertSame(42, sbp($tmp . '_return_dev'));
 }
Esempio n. 3
0
 public function testBenchmark()
 {
     $tmp = $this->getTmp();
     copy(__DIR__ . '/../files/.src/short_tag.php', $tmp . '_short_tag.sbp.php');
     sbp_benchmark();
     sbp($tmp . '_short_tag');
     $contents = sbp_benchmark_end();
     $this->assertFalse(empty($contents), 'benchmark should provide some contents');
     $this->assertTrue(preg_match('`
         <html[^>]*>\\s*<head>[\\s\\S]+?</head>\\s*
             <body>\\s*
                 <h1>Benckmark</h1>\\s*
                 <ul>\\s*
                     <li>Start\\s+benchmark</li>\\s*
                     <li><b>[^<]+</b>End\\s+benchmark</li>\\s*
                 </ul>\\s*
                 <p>All:\\s+<b>[^<]+</b></p>\\s*
                 <h1>Code\\s+source</h1>\\s*
                 <pre>Hello\\s+World!</pre>\\s*
             </body>\\s*
         </html>
     `x', $contents) > 0, 'benchmark return times in a HTML template');
 }
Esempio n. 4
0
<?php

include_once '../../src/Sbp/Sbp.php';
sbp('main.php');
Esempio n. 5
0
<?php

sbp(__DIR__ . '/JsParseSbp.php');
Esempio n. 6
0
<?php

sbp(__DIR__ . '/CssParserSbp.php');