Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Reads entire file into a string
<?php file_get_contents( string $filename, bool $use_include_path = false, ?resource $context = null, int $offset = 0, ?int $length = null): string|false
<?php Lock::backup();
$this->assertFileExists($this->backupLockPath);
$this->assertEquals($content, file_get_contents($this->backupLockPath));
}
<?php Lock::backup($this->customLockPath);
$this->assertFileExists($this->customBackupLockPath);
$this->assertEquals($content, file_get_contents($this->customBackupLockPath));
}
private function removeLockFiles()
<?php $suffixlessPath = $this->directory.'/blog/2017-07-04.test.md';
file_put_contents($existingPath, 'id: 123');
$entry = $this->parent->store('blog')->makeItemFromFile($existingPath, file_get_contents($existingPath));
$this->parent->store('blog')->save($entry);
<?php $newPath = $this->directory.'/blog/2017-07-04.updated.md';
file_put_contents($existingPath, 'id: 123');
$entry = $this->parent->store('blog')->makeItemFromFile($existingPath, file_get_contents($existingPath));
$entry->slug('updated');
<?php {
$this->assertFileExists($filename);
$this->assertEquals($expected, file_get_contents($filename));
}
protected function assertContainsHtml($string)
<?php public function combines_two_views()
{
Event::fake();
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'));
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
<?php {
Event::fake();
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'));
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
->template('template')
<?php public function a_layout_can_be_in_the_layouts_directory()
{
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'));
$this->viewShouldReturnRaw('layouts.test', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
<?php public function a_layout_can_be_in_the_layouts_directory()
{
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'));
$this->viewShouldReturnRaw('layouts.test', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
->template('template')
<?php public function template_is_rendered_alone_if_no_layout_is_provided()
{
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'));
$view = (new View)
->template('template')
<?php public function a_non_antlers_template_will_not_attempt_to_load_the_layout()
{
Event::fake();
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'), 'blade.php');
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
<?php {
Event::fake();
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template.antlers.html'), 'blade.php');
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
->template('template')
<?php public function template_with_noparse_is_left_unparsed()
{
$this->viewShouldReturnRaw('partial-with-noparse', file_get_contents(__DIR__.'/fixtures/partial-with-noparse.antlers.html'));
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template-with-noparse.antlers.html'));
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
<?php public function template_with_noparse_is_left_unparsed()
{
$this->viewShouldReturnRaw('partial-with-noparse', file_get_contents(__DIR__.'/fixtures/partial-with-noparse.antlers.html'));
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template-with-noparse.antlers.html'));
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
<?php {
$this->viewShouldReturnRaw('partial-with-noparse', file_get_contents(__DIR__.'/fixtures/partial-with-noparse.antlers.html'));
$this->viewShouldReturnRaw('template', file_get_contents(__DIR__.'/fixtures/template-with-noparse.antlers.html'));
$this->viewShouldReturnRaw('layout', file_get_contents(__DIR__.'/fixtures/layout.antlers.html'));
$view = (new View)
->template('template')