Esempio n. 1
0
    def test_execute_fixer(self):
        tool = Phpcs(self.problems, {'fixer': True})

        original = read_file(self.fixtures[1])
        tool.execute_fixer(self.fixtures)

        updated = read_and_restore_file(self.fixtures[1], original)
        assert original != updated, 'File content should change.'
        eq_(0, len(self.problems.all()), 'No errors should be recorded')
Esempio n. 2
0
    def test_execute_fixer(self):
        tool = Phpcs(self.problems, {'fixer': True})

        original = read_file(self.fixtures[1])
        tool.execute_fixer(self.fixtures)

        updated = read_and_restore_file(self.fixtures[1], original)
        assert original != updated, 'File content should change.'
        eq_(0, len(self.problems.all()), 'No errors should be recorded')
Esempio n. 3
0
    def test_execute_fixer__no_problems_remain(self):
        tool = Phpcs(self.problems, {'fixer': True})

        # The fixture file can have all problems fixed by phpcs
        original = read_file(self.fixtures[1])
        tool.execute_fixer(self.fixtures)
        tool.process_files(self.fixtures)

        read_and_restore_file(self.fixtures[1], original)
        eq_(0, len(self.problems.all()), 'All errors should be autofixed')
Esempio n. 4
0
    def test_execute_fixer__no_problems_remain(self):
        tool = Phpcs(self.problems, {'fixer': True})

        # The fixture file can have all problems fixed by phpcs
        original = read_file(self.fixtures[1])
        tool.execute_fixer(self.fixtures)
        tool.process_files(self.fixtures)

        read_and_restore_file(self.fixtures[1], original)
        eq_(0, len(self.problems.all()), 'All errors should be autofixed')