HM\BackUpWordPress\Backup_Engine_Excludes::test_excluded_file_via_parent_directory_is_excluded PHP Method

test_excluded_file_via_parent_directory_is_excluded() public method

Main test: Excludes->is_file_excluded( $file ) Expected: true.
    public function test_excluded_file_via_parent_directory_is_excluded()
    {
        $file_path = $this->test_data . '/test-data.txt';
        $file = new \SplFileInfo($file_path);
        // Check the file is created and its size is NOT 0.
        $this->assertContains($this->root->getPath(), $file->getPath());
        $this->assertNotSame($file->getSize(), 0);
        // Exclude the parent directory, so the file in it is excluded by "inheritance".
        $excluded_dir_name = basename($file->getPath());
        // test-data directory, the parent dir of the file.
        $excluded_dir = new Excludes($excluded_dir_name);
        // Check the directory is excluded. File in that directory should be excluded too.
        $this->assertContains($excluded_dir_name, $excluded_dir->get_user_excludes());
        $this->assertTrue($excluded_dir->is_file_excluded($file));
    }