Hostnet\Component\Webpack\Asset\TrackerTest::testIsOutdated PHP Method

testIsOutdated() public method

The the isOutdated function in case the 'compiled' version is outdated.
public testIsOutdated ( )
    public function testIsOutdated()
    {
        $path = tempnam(sys_get_temp_dir(), 'unittest_tracker_source');
        unlink($path);
        mkdir($path);
        $output_directory = tempnam(sys_get_temp_dir(), 'unittest_tracker_output');
        unlink($output_directory);
        mkdir($output_directory);
        $time = time();
        $file = tempnam($path, 'unittest_tracker_source_asset');
        touch($file, $time);
        $file2 = tempnam($output_directory, 'unittest_tracker_output_compiled');
        touch($file2, $time - 100);
        $profiler = $this->prophesize(Profiler::class);
        $profiler->set('tracker.reason', 'One of the tracked files has been modified.')->shouldBeCalled();
        $profiler->set('bundles', [])->shouldBeCalled();
        $profiler->set('templates', [])->shouldBeCalled();
        $finder = $this->prophesize(TemplateFinderInterface::class);
        $finder->findAllTemplates()->willReturn([]);
        $tracker = new Tracker($profiler->reveal(), $finder->reveal(), $this->root_dir, $this->asset_dir, $output_directory);
        $tracker->addPath($path);
        self::assertTrue($tracker->isOutdated());
        //Cleanup
        $fs = new Filesystem();
        $fs->remove($path);
        $fs->remove($output_directory);
    }