/**
  * File is excluded as a result of being in an excluded directory.
  *
  * Main test: Site_Size->filesize( $file )
  * Expected:  file size should be 0.
  */
 public function test_file_size_excluded_via_parent_directory()
 {
     $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" - file size should be 0.
     $excluded_dir_name = basename($file->getPath());
     // test-data directory, the parent dir of the file.
     $excluded_dir = new Excludes($excluded_dir_name);
     $excluded_dir_site_size = new Site_Size('file', $excluded_dir);
     // Check the directory is excluded. File size in that directory should return 0.
     $this->assertContains($excluded_dir_name, $excluded_dir->get_user_excludes());
     $this->assertSame($excluded_dir_site_size->filesize($file), 0);
 }
 /**
  * File is NOT excluded directly (either in the root or any non-excluded sub-directory).
  *
  * Main test: Excludes->is_file_excluded( $file )
  * Expected:  false.
  */
 public function test_non_excluded_file_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);
     // Do NOT exclude the parent directory, so the file in it is also non excluded by "inheritance".
     $non_excluded_dir_name = basename($file->getPath());
     // test-data directory, the parent dir of the file.
     $non_excluded_dir = new Excludes();
     // Check the directory is NOT excluded. File in that directory should be NOT excluded too.
     $this->assertNotContains($non_excluded_dir_name, $non_excluded_dir->get_user_excludes());
     $this->assertFalse($non_excluded_dir->is_file_excluded($file));
 }