PHP Classes

File: tests/src/FileRenamer/CoreTest.php

Recommend this page to a friend!
  Classes of Sergii Pryz   PHP File Renamer   tests/src/FileRenamer/CoreTest.php   Download  
File: tests/src/FileRenamer/CoreTest.php
Role: Unit test script
Content type: text/plain
Description: Only script location was changed.
Class: PHP File Renamer
Rename files in directory using several strategies
Author: By
Last change:
Date: 10 years ago
Size: 1,653 bytes
 

Contents

Class file image Download
<?php
/**
 * Core FileRenamer UnitTest
 *
 * @link https://github.com/picamator/FileRenamer
 * @license http://opensource.org/licenses/BSD-3-Clause New BSD License
 */

namespace FileRenamer;
use
FileRenamer\Strategy\Translit;

class
CoreTest extends BaseTest
{
   
/**
     * Path to the Source folder
     *
     * @var string
     */
   
protected $source_path;
   
   
/**
     * Report
     *
     * @var Report\Csv
     */
   
protected $report;
   
   
/**
     * @see BaseTest
     */
   
protected function setUp()
    {
       
parent::setUp();
       
       
$this->source_path = $this->data_path.'RenameMe';
       
$this->report = new Report\Csv;
    }
   
   
/**
     * Test for Hash Strategy
     *
     * @param Strategy\StrategyInterface $strategy
     * @dataProvider strategyProvider
     */
   
public function testStrategy(Strategy\StrategyInterface $strategy)
    {
       
$core = new Core($this->source_path, $strategy, $this->report);
       
$core->run();
       
       
$report_path = $this->report->getReportPath();
       
$this->assertTrue(file_exists($report_path));
    }
   
   
/**
     * Data Provider for testStrategy
     *
     * @return array
     */
   
public function strategyProvider()
    {
        return array(
            array(new
Strategy\Hash),
            array(new
Strategy\Microtime),
            array(new
Translit\General),
            array(new
Translit\Ukrainian),
            array(new
Translit\Russian),
            array(new
Translit\Hungarian),
            array(new
Translit\Portuguese),
            array(new
Translit\German)
        );
    }
}