Skip to content
Snippets Groups Projects
Select Git revision
  • dd8967a88c88bd37cbc1a99b52544b33de204fd1
  • master default protected
  • 1.31
  • 4.24.3
  • 4.24.2
  • 4.24.1
  • 4.24.0
  • 4.23.6
  • 4.23.5
  • 4.23.4
  • 4.23.3
  • 4.23.2
  • 4.23.1
  • 4.23.0
  • 4.22.3
  • 4.22.2
  • 4.22.1
  • 4.22.0
  • 4.21.0
  • 4.20.1
  • 4.20.0
  • 4.19.0
  • 4.18.0
23 results

form.mjs

Blame
  • target-phpunit.mk 2.00 KiB
    #############################################################################################
    #############################################################################################
    ##
    ## PHPUNIT
    ##
    #############################################################################################
    #############################################################################################
    
    # path and binaries
    PARALLEL               ?= parallel
    
    EXECUTABLES = $(EXECUTABLES:-) $(PARALLEL); 
    
    PHPUNIT_PATH            := $(VENDOR_PATH)phpunit/
    PHPUNIT_BIN             := $(PHPUNIT_PATH)phpunit
    PHPUNIT_SCRIPT_PATH     := $(BUILD_PATH)/script
    
    
    ifeq ($(shell command -v $(PARALLEL) 2> /dev/null),)
      $(error "parallel is not installed. Please install parallel")
    endif
    
    ifneq ($(shell test -d $(PHPUNIT_SCRIPT_PATH) && echo -n yes),yes)
        $(shell mkdir -p $(PHPUNIT_SCRIPT_PATH))
    endif
    
    define UNITTEST_SH_SCRIPT
    #!/bin/bash
    
    BIN=$$1
    BOOTSTRAP=$$2
    CONFIG=$$3
    TESTFILES=$$4
    
    export DOCOVERAGE=true
    
    groups=$$($${BIN} \
               --list-groups \
               --bootstrap $${BOOTSTRAP} \
               --configuration $${CONFIG} \
               development/tests/ | sed -n -e '/^ - /p' | cut -d"-" -f2 |  tr -d ' ')
    
    parallel \
        $${BIN} \
                --group {} \
                --configuration $${CONFIG} \
                --whitelist application/source/ \
                --bootstrap $${BOOTSTRAP} \
                $${TESTFILES}  ::: $${groups}
    endef
    
    export UNITTEST_SH_SCRIPT
    
    $(PHPUNIT_SCRIPT_PATH)/unittests.sh:
    	$(QUIET) $(ECHO) "$$UNITTEST_SH_SCRIPT" >> $@
    	$(CHMOD) u+x $(PHPUNIT_SCRIPT_PATH)/unittests.sh
    
    $(PHPUNIT_BIN):
    	$(MKDIR) -p $(PHPUNIT_PATH)
    	$(WGET) -O $(PHPUNIT_BIN) https://phar.phpunit.de/phpunit-9.phar
    	$(CHMOD) u+x $(PHPUNIT_BIN)
    	$(CHMOD) u+x $(PHPUNIT_SCRIPT_PATH)/unittests.sh
    
    .PHONY: run-phpunit-tests
    ## run PHPUNIT Tests
    run-phpunit-tests: $(PHPUNIT_SCRIPT_PATH)/unittests.sh $(PHPUNIT_BIN)
    	$(BUILD_SCRIPTS_PATH)unittests.sh "$(PHPUNIT_BIN)" "$(TEST_PATH)script/bootstrap.inc.php" "$(TEST_PATH)config/phpunit.xml" "$(TEST_PATH)"