/**
  * @dataProvider providerTestGetLayoutChoices
  */
 function testGetLayoutChoices($files, $expected_results)
 {
     $cp = $this->getMock('ComicPress', array('_glob', '_file_get_contents'));
     _set_template_directory('/test');
     $file_names = array();
     foreach (array_keys($files) as $file) {
         $file_names[] = '/test/layouts/' . $file;
     }
     $cp->expects($this->once())->method('_glob')->with('/test/layouts/*')->will($this->returnValue($file_names));
     foreach ($files as $file => $contents) {
         $cp->expects($this->once())->method('_file_get_contents')->with('/test/layouts/' . $file)->will($this->returnValue($contents));
     }
     $this->assertEquals($expected_results, $cp->get_layout_choices());
 }
 /**
  * @dataProvider providerTestFindFile
  */
 function testFindFile($files_to_setup, $search_path, $post_categories, $expected_path_result)
 {
     global $post;
     mkdir(vfsStream::url('root/parent/partials/comic/chapter-1'), 0777, true);
     mkdir(vfsStream::url('root/child/partials/comic/chapter-1'), 0777, true);
     foreach ($files_to_setup as $path) {
         file_put_contents(vfsStream::url($path), "test");
     }
     _set_template_directory(vfsStream::url('root/parent'));
     _set_stylesheet_directory(vfsStream::url('root/child'));
     $post = (object) array('ID' => 1);
     wp_set_post_categories(1, array(2));
     add_category(1, (object) array('slug' => 'comic', 'parent' => 0));
     add_category(2, (object) array('slug' => 'chapter-1', 'parent' => 1));
     $this->assertEquals($expected_path_result, $this->cp->find_file('index.inc', $search_path, $post_categories));
 }