Exemplo n.º 1
0
 public function testControllerNameAndMethodAreBeingPassed()
 {
     $return = array(null, array(), null);
     $this->dispatcher->expects($this->once())->method('dispatch')->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod))->will($this->returnValue($return));
     $this->expectOutputString('');
     App::main($this->controllerName, $this->controllerMethod, $this->container);
 }
Exemplo n.º 2
0
<?php

set_time_limit(0);
ini_set('default_socket_timeout', 900);
\App::main();
class App
{
    private static $xmlFile = "import.xml";
    private static $newxmlFile = "importnew.xml";
    private static $imagePath = "/data/tmp/pics";
    public static function main()
    {
        self::process();
    }
    public static function process()
    {
        $xml = simpleXML_load_file(self::$xmlFile, "SimpleXMLElement", LIBXML_NOCDATA);
        foreach ($xml->Offers->Item as $Item) {
            foreach ($Item->Images->Image as $image) {
                self::getImage($image);
            }
        }
    }
    private static function getImage($url)
    {
        $logElements = array();
        $startTime = microtime(true);
        $url = (string) $url;
        $name = end(explode("/", $url));
        $filename = self::$imagePath . "/" . $name;
        $result = file_put_contents($filename, file_get_contents($url));
Exemplo n.º 3
0
        if ($numFilesToCopy < 1) {
            $numFilesToCopy = 1;
        }
        $fileName = 'test.yml';
        $filePath = __DIR__ . '/' . $fileName;
        $yamlArr = Yaml::parse(file_get_contents($filePath));
        $newFilenamePrefix = $yamlArr['new_filename_prefix'];
        try {
            $filesystem = new Filesystem();
            for ($i = 1; $i <= $numFilesToCopy; $i++) {
                $newFilepath = __DIR__ . "/{$newFilenamePrefix}_{$i}.yml";
                $filesystem->copy($filePath, $newFilepath);
            }
        } catch (FileNotFoundException $e) {
            echo "File '{$filePath}' could not be found!" . PHP_EOL;
        } catch (IOException $e) {
            echo "Could not copy file '{$filePath}' to '{$newFilepath}'!" . PHP_EOL;
        } finally {
            // Just for fun
            unset($filesystem);
        }
        $funny = (int) ((0.7 + 0.1) * 10);
        echo $funny . PHP_EOL;
        $notFunny = BigDecimal::of(0.7)->plus(BigDecimal::of(0.1))->multipliedBy(10)->toInteger();
        echo $notFunny . PHP_EOL;
        $notFunny = BigRational::of('7/10')->plus(BigRational::of('1/10'))->multipliedBy(10)->toInteger();
        echo $notFunny . PHP_EOL;
    }
}
App::main($argc, $argv);
Exemplo n.º 4
0
<div class="container">
    <!-- Main hero unit for a primary marketing message or call to action -->
    <div class="hero-unit">
        <h1>Admin/Documents <small>subcontroller</small></h1>
        <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
        <p><a class="btn btn-large" href="<?php 
echo App::main()->url();
?>
"><i class="icon-white- icon-home"></i> Back to the main site</a></p>

    </div>

    <h2>Documents:</h2>
    <pre><?php 
print_r($docs);
?>
</pre>
    <?php 
include App::main()->templatesPath() . "debug.php";
?>
</div>
Exemplo n.º 5
0
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
    <h1>This is a demo template</h1>
    <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
    <p><a class="btn btn-large" href="<?php 
echo App::main()->url();
?>
"> <i class="icon-chevron-left"></i> back to home</a></p>
</div>

<?php 
include "debug.php";