Carew\Tests\Command\BuildTest::testExecuteWithRegularSite PHP Method

testExecuteWithRegularSite() public method

    public function testExecuteWithRegularSite()
    {
        $this->deleteDir($webDir = __DIR__ . '/fixtures/site/web');
        $application = $this->runApplication(dirname($webDir));
        $this->assertSame(0, $application->getStatusCode());
        // Posts
        $this->assertTrue(file_exists($webDir . '/2010/01/01/hello.html'));
        $crawler = new Crawler(file_get_contents($webDir . '/2010/01/01/hello.html'));
        $this->assertSame('Hello', $crawler->filter('title')->text());
        $this->assertSame('Hello', $crawler->filter('h1')->text());
        $this->assertTrue(file_exists($webDir . '/2010/01/02/post2.html'));
        $this->assertTrue(file_exists($webDir . '/2010/01/03/post3.html'));
        $this->assertTrue(file_exists($webDir . '/2010/01/04/good-bye.html'));
        // Pages
        $this->assertTrue(file_exists($webDir . '/index.html'));
        $crawler = new Crawler(file_get_contents($webDir . '/index.html'));
        $this->assertSame('index', $crawler->filter('title')->text());
        $this->assertSame('index', $crawler->filter('h1')->text());
        $this->assertCount(3, $crawler->filter('ul'));
        // posts list
        $this->assertCount(4, $crawler->filter('ul')->eq(0)->filter('li'));
        $this->assertSame('Good bye', trim($crawler->filter('ul')->eq(0)->filter('li')->eq(0)->text()));
        $this->assertSame('Hello', trim($crawler->filter('ul')->eq(0)->filter('li')->eq(3)->text()));
        // pages list
        $this->assertCount(1, $crawler->filter('ul')->eq(1)->filter('li'));
        $this->assertSame('Index', trim($crawler->filter('ul')->eq(1)->filter('li')->eq(0)->text()));
        // api list
        $this->assertCount(1, $crawler->filter('ul')->eq(2)->filter('li'));
        $this->assertSame('Api', trim($crawler->filter('ul')->eq(2)->filter('li')->eq(0)->text()));
        // Api
        $this->assertTrue(file_exists($webDir . '/api/api.html'));
        $this->assertSame("api\n", file_get_contents($webDir . '/api/api.html'));
        // Assets
        $this->assertTrue(file_exists($webDir . '/styles.css'));
        $this->assertSame("css\n", file_get_contents($webDir . '/styles.css'));
        $this->deleteDir($webDir);
    }